After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 129472 - Adds option to strip color data from transparent pixels
Adds option to strip color data from transparent pixels
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other All
: Normal enhancement
: 2.0
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2003-12-16 16:31 UTC by Joao S. O. Bueno
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Patch to implement the enhancement. (4.53 KB, patch)
2003-12-16 16:33 UTC, Joao S. O. Bueno
none Details | Review
Updated patch which installs a new procedure (6.64 KB, patch)
2003-12-26 21:41 UTC, Dave Neary
none Details | Review

Description Joao S. O. Bueno 2003-12-16 16:31:12 UTC
As Raphael has pointed in a recent thread in Gimp-devel, uniformizing 
pixels hid by a 0 value of alpha can enhance the compression of PNG files, 
and seens to be even recommended. 
 
Making it optional preserves the user control over his own image. 
 
I am adding a patch that adds the option to reset or not the color values 
for transparent pixels when saving a RGBA PNG image. The patch sets the 
transparent pixels to zero, or to the current background color, if the 
user chooses "Save Background Color".
Comment 1 Joao S. O. Bueno 2003-12-16 16:33:00 UTC
Created attachment 22484 [details] [review]
Patch to implement the enhancement.
Comment 2 Dave Neary 2003-12-20 11:19:16 UTC
Hi,

I think this could be committed before 2.0 - it's a small change,
which is a useful optimisation. Setting the 1.3.x milestone. I don't
think I will have time to commit this - unless there are objections,
could someone else do the necessary?

Thanks,
Dave.
Comment 3 Sven Neumann 2003-12-25 12:17:53 UTC
The problem here is that the patch changes the PDB API. This would
break a lot of scripts that call file-save-png. I am not sure if it's
worth it.

I also have some minor issues with the code change itself, namely
variable names and the use of a binary shift operation where a simple
multiplication would be more readable. The compiler will generate the
same binary code anyway.
Comment 4 Joao S. O. Bueno 2003-12-26 01:55:14 UTC
As for the PDB API: I took care of having the filter accept either 
the previous 12 parameters or the 13 parameters after the patch. 
AT least py-slice (python rewrite of perl-o-tine) worked fine with 
the patch applied. 
 
Maybe more testing should be done. I could only think of this pluguin 
that uses png save. 
 
IMHO, 15% smaller PNGs for web-developers is something that could 
make a difference right for 2.0.  
 
Otherwise, here goes another idea: make the "zero out transparent 
pixels to save" a global GIMP option, and have then zeroed in the 
flatten image function called when a multi-layer image is exported to 
be saved. That would not hurt the PDB, and would work for all file 
formats, but I do not see it coming in for earlier than 2.1 -  
 
Meanwhile, the GIMP could have this one more utility to web artists. 
Cansomeone check if any filters are really broken? 
 
As for the variable names, and the shift, I will take care of them. 
 
 
Comment 5 Sven Neumann 2003-12-26 02:26:34 UTC
Didn't knew that omitting parameters works for py-gimp also. It
doesn't work for script-fu though. However, I don't have a strong
opinion on this. Perhaps someone else's opinion can help to decide
this point.
Comment 6 Manish Singh 2003-12-26 03:30:39 UTC
I'd rather not break the PDB api. How about just registering a second
procedure for this?
Comment 7 Dave Neary 2003-12-26 10:37:12 UTC
I'd like to see this applied, if it doesn't break stuff. I thought 
the trick of omitting pdb parameters was pretty widespread... if it's 
not we should have two calls for the PDB registered, as is done in 
the edge detect plug-in, for example.

Cheers,
Dave.
Comment 8 Dave Neary 2003-12-26 21:41:32 UTC
Created attachment 22727 [details] [review]
Updated patch which installs a new procedure
Comment 9 Dave Neary 2003-12-26 21:43:02 UTC
There might be better ways to do this, but anyway - here's an updated
patch with a fair amount of copy & pasting. Two sets of arguments, two
procedure calls.

Can someone have a look and see if this is OK to commit?

Cheers,
Dave.
Comment 10 Sven Neumann 2004-01-05 00:57:30 UTC
2004-01-05  Sven Neumann  <sven@gimp.org>

  * plug-ins/common/png.c: applied a modified patch provided by
  Joao S. O. Bueno and Dave Neary. The user can now specify whether
  color values for transparent pixels should be saved or nullified
  (bug #129472).