Disabling PNG palettes

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Disabling PNG palettes

Post by fmw42 »

glennrp wrote:Because of the -fuzz, your command produces a number of different nearly-white transparent colors.
But I added -background gray -alpha background. That should have changed all transparent pixels so they were gray under the transparency, like Anthony did in his example. The only difference I can see is he actually wrote the image specifically as PNG24: and I did not.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Disabling PNG palettes

Post by glennrp »

fmw42 wrote:
glennrp wrote:Because of the -fuzz, your command produces a number of different nearly-white transparent colors.
But I added -background gray -alpha background. That should have changed all transparent pixels so they were gray under the transparency, like Anthony did in his example. The only difference I can see is he actually wrote the image specifically as PNG24: and I did not.
OK, the -alpha was missing from the messages above. If I add that, the transparent pixels are all 126,126,126. Apparently the test for single-color transparency doesn't work for some reason with this test case (actually the test works, debug reports "cheap transparency is possible", but color-type 6 is still written). I'll investigate that.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Disabling PNG palettes

Post by anthony »

Fuzz is just a color match setting for specific IM operators (opaque, transparent, trim, gif optimizations). It basically lets you specify a spherical range of colors (in whatever colorspace the image is in) for whatever purpose, such as color replacement with 'none' (fully transparent).

Note that 'none' (fully-transparent black) is probably not a good choice for the hidden transparency color, Another common choice for this color (in GIF images for web use) is "silver" (sRGB visually 50% gray) but even this is often not a good choice. That is why in the above example I use "hotpink" which is a very uncommon color, though it look horrible in any viewer that may not handle 'indexed transparency'. For example the "XV" command I often use as a simple image viewer/editor does not handle transparency.

You can actually use a grey of some kind as the transparency color, but only if you specifically remap other matching foreground colors to some other slightly different grey color (like "Gray75" or "Grey")

Visually Mid-tone Grays (for transparency)....

Code: Select all

Gray76:    #C2C2C2
Silver:    #C0C0C0
Gray75:    #BFBFBF
Grey:      #BEBEBE
Gray74     #BDBDBD
There is no name for the color #C1C1C1

Default background (for example used by -border) is #DFDFDF
while the default matte color (as used by -frame 1) is: gray74
Note the variations of the matte color used by -frame 3x3+1+1 (mathematically generated) include...
#DE38DE38DE38, #D286D286D286, #647364736473 and #51D951D951D9
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Disabling PNG palettes

Post by fmw42 »

glennrp wrote:OK, the -alpha was missing from the messages above
Yes, sorry about that. It was a typo when copying the command I actually used.
Post Reply