Hello hello, > Now that you defined your problem exactly, I can give you a > solution with semi-transparent red for pixels that are grey. >
Haha, I'm still working on that exact definition :-). The solution I came up with, providing a colormap and converting from grayscale, did work to get me 2 color images with 256 color table. However, it was giving me gif-style transparency, where the transparent color is defined (from what I can tell) as a key-value pair. After looking at the working example I get back from IrfanView, and reading some of the png spec, what I really want (what my renderer seems to be best optimized for) is RGBA-Palette, as defined here: http://www.libpng.org/pub/png/book/chapter08.html#png.ch08.div.5.2 I have now found that I can generate a 2 color png and then, using TweakPNG, I can insert a tRNS chunk into the png, then edit the color palette and set the alpha value of black, in the palette, to 0. Once I had that working, I then had to figure out how to insert the tRNS chunk programmatically. Can this be done with ImageMagick? The solution I'm using now, on a windows machine, involves the png utility "PNGCRUSH". Since I'm using the netscape: color palette I know the first color in my color palette will be black, so I just run pngcrush like this and I get an RGBA-Palette image: pngcrush -trns_array 1 0 test2.png test3.png The -trns_array will generate alpha values for the first N colors in the color palette, so 1 0 sets the first color (black) to transparent. If anyone else is having problems with Java rendering 8bit png's slowly, or if the png's are taking up too much memory, I would recommend this approach. Without a tRNS chunk and color palette I consistently see poorer performance out of the Java render pipeline. Cheers, Andrew > See IM Examples, Masks as Colored Shapes > http://www.imagemagick.org/Usage/channels/#shapes > > Try... > convert test.png +clone +matte -compose CopyOpacity -composite \ > -fill Red -colorize 100% red.png > > This will ensure any anti-aliased edges remain anti-aliased. > > Of course it has semi-transparency, which in other > discussions you said you did not want. So I am glad if you > solution produces PNG8 images with 256 color colortables. > > > Is that the case? That is you have 2 color images with 256 > color colortables. > > If so -map will be extremely more important to Animation > color reducion than I previously throught. Seeing it is the > only way to convert images, into indexed color images in memory. > > Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]> > > -------------------------------------------------------------- > --------------- > Our continuing mission: To seek out knowledge of C, to > explore strange > UNIX commands and to boldly code where no one has manpage 4... > > -------------------------------------------------------------- > --------------- > Anthony's Home is his Castle > http://www.cit.gu.edu.au/~anthony/ > _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
