PNG compression broken in mtPaint

Running Jaunty pup, I found that when saving PNG images, compression level can only be set to zero (uncompressed).

I compiled libpng, no difference. libz is a dependency in both mtpaint and libpng, so that is okay.

I did a quick google, found one Ubuntu user complaining that he saved a PNG file and it got much bigger. I doubt many Ubuntu users use mtPaint, which is why I didn't get many hits when searching for "mtpaint compression ubuntu".

I tried mtPaint 3.21 out of puppy 412, same problem. But, PNG compression does work in Puppy 4.

I tried mtPaint 3.10 out of Puppy 3.0.1, yay, PNG compression now works.

The thing is, from version 3.20 there as a new system of selecting PNG compression level. Previously it was fixed. Something is wrong with that selection mechanism.

I don't want to roll back to 3.10 or 3.11. I have sent an application to join the mtPaint mail-list and will report this problem. Once upon a time I did have the email address of the current maintainer, also he is a member of the forum -- anyone know how to contact him directly?


Posted on 1 May 2009, 18:21


Comments:

Posted on 30 Apr 2009, 21:53 by coolpup
wjaguar
STARTwjaguarATusers.sourceforge.netEND

mtPaint-3.31
http://sourceforge.net/project/showfiles.php?group_id=155874&package_id=173703




Posted on 31 Apr 2009, 5:59 by happypuppy
The new mtPaint 3.31 is much better
3.20? You must be living in a cave :D
The latest one is 3.31.

Lots of new features,many bugfixes,stable and polished:

http://www.murga-linux.com/puppy/viewtopic.php?search_id=291440025&t=22164




Posted on 1 May 2009, 9:05 by BarryK
mtPaint
You have misread my post. I rolled back to testing 3.21, but the version I am running in Jaunty pup is 3.31, which has the PNG bug.



Posted on 1 May 2009, 9:15 by Jesse
Patch MtPaint source
Hi,
PNG writing options are fully controlled by the application.
Search the png writing component of MTPaint, add in png_set_compression_level at the right spot, its easy as.
Here is example sequence:

png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
info_ptr = png_create_info_struct(png_ptr);
png_set_write_fn(png_ptr, (void *) png, user_write_data, user_flush_data);
... either one of the following 2 lines ...
png_set_compression_level(png_ptr, 6 ); // 6 == default compression
png_set_compression_level(png_ptr, PNGWRITER_DEFAULT_COMPRESSION);
png_set_IHDR(png_ptr, info_ptr, png->width, png->height,
png->bit_depth, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
...lots of other png stuff may be here...
png_write_info(png_ptr, info_ptr);
png_write_image(png_ptr, png->graph);
png_write_end(png_ptr, info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);



Posted on 1 May 2009, 11:05 by BarryK
Re: patch mtpaint
Jesse,
Haven't "heard" from you for awhile!

Heh, heh, you have just volunteered yourself to do it!

I don't care if it remains stuck on '6', I don't think we have any situations where we would want to save a PNG as uncompressed.

Alpha6 is imminent, you can try it out, even give alpha6 a play, checkout whether your 'mut2' is behaving itself. It's still the alternative engine for Pmount.

Also your 'elspci' is still there!

The 'devx' for alpha6 will also be available.



Posted on 1 May 2009, 16:07 by ttuuxxx
PNG, APNG, and security warnings
He Barry I was the one who compiled PNG for 4.2, Its the best PNG around :) The reason why is that I compiled it with animated PNG, a new format that ff3 uses, Its just like animated gifs, but PNG and the animation is way smoother, A lot of newer websites will be using this format and oly ff3 has this maybe seamonkey 2.0+, You need to patch png first before compiling it for Apng to work, if not all Apng files will be a single still frame.
Its also a dep for FF3.

Also there a very large security warning about previous png's
http://www.libpng.org/pub/png/libpng.html
Vulnerability Warning
All versions of libpng from 0.89c through 1.2.34 contain an uninitialized-data bug that can be triggered by a malicious user. Specifically, there are several instances in which a malloc'd array of pointers is then initialized by a secondary sequence of malloc() calls. If one of these calls fails, libpng's cleanup routine will attempt to free the entire array, including any uninitialized pointers, which could lead to execution of an attacker's code with the privileges of the libpng user (including remote compromise in the case of a libpng-based browser visiting a hostile web site). This vulnerability has been assigned ID CVE-2009-0040 and is fixed in version 1.2.35, released 18 February 2009.

ttuuxxx


Posted on 3 May 2009, 9:13 by Jesse
MTPaint 3.31
Hi BarryK,
I just had a look-see at mtPaint source code 3.31, it correctly sets the PNG compression level to be what is on the save dialog window. So I'd guess go with that version as long as there is no other issues?



Posted on 3 May 2009, 13:42 by BarryK
mtpaint
Jesse,
Solved, see later post:
http://puppylinux.com/blog/?viewDetailed=00704