Re: Converting to PNG8 loses transparency
Kenneth Xu <[email protected]> Fri, 28 Jun 2013 13:47:24 -0400
| Newsgroups | gmane.comp.video.graphicsmagick.tools |
|---|---|
| Message-ID | <CAErMi7gQh0idwL-bPOBBe=48_N2zmivvNYa+m7eOsGPjZ+mB_g@mail.gmail.com> |
My message did show up in the archive page on sourceforge correctly so trying it again. Sorry for the duplicates if any. Your help is very much appreciated. On Sat, Jun 22, 2013 at 10:11 AM, Kenneth Xu <[email protected]> wrote: > > Hi Gleen, > > Thanks for your quick response and the helpful information. I'm trying to use -colors option but without much success. Would you please help me further? > > I start with an original 32bit PNG with transparency called test600.png (262K), and converted to 8bit PNG by pngquant called test600quant.png (152K). > > $ gm convert test600.png -colors 256 test600_256.png > Above command created an 8bit PNG (139K) WITHOUT transparency. > > $ gm convert test600.png -scale 300 -colors 256 test300_256.png > This time it created an 32bit PNG with transparency, as if I didn't specify -colors option > > $ gm convert test600quant.png -scale 300 -colors 256 test300_256.png > Using the 8bit pngquant image as source, I still get an 32bit PNG with transparency. same with or without -colors option. > > My goal is to use GM, resize the original source or preprocessed by pngquant (both attached), to 8bit PNG format with transparency. > > What am I doing wrong? > > Thanks in advance! > > Kenneth > > On Thu, Jun 20, 2013 at 10:16 PM, Glenn Randers-Pehrson <glennrp@gm...> wrote: >> >> In GraphicsMagick, "PNG8" means indexed 8-bit PNG with optional binary >> transparency. PNG can represent 8-bit images with full transparency, but >> that is not what we call PNG8. "pngquant" is a handy third-party >> application that can reduce a 32-bit RGBA PNG image to 8-bit with full >> transparency (it reduces the palette to 256 or fewer RGBA entries, which >> are represented in PNG via the PLTE and tRNS chunks). You can get such >> 8-bit indexed images with full transparency via the -colors 255 option, >> etc, but not by using the PNG8: format descriptor. Note that PNG8 is not >> defined by the PNG specification but rather by various other parties. When >> we defined "PNG8" in GraphicsMagick, the target for such images was a major >> commercial browser that could not handle the tRNS chunk properly to decode >> and display full transparency. >> >> >> >> On Thu, Jun 20, 2013 at 12:18 PM, Kenneth Xu <sourceforge@...> wrote: >> >> > Hello, >> > >> > This may be a dumb question but I did google as well as searching archive >> > but cannot seem to find the answer. I'm trying to convert an PNG32 image to >> > PNG8 using command below: >> > >> > gm convert source.png png8:target.png >> > >> > The command is useful to us as it reduces the image size to half but still >> > yet good quality (see http://www.sitepoint.com/png8-the-clear-winner/). >> > The problem is any transparency in source image is lost in the target >> > image. The closest post I can find in the archive is this one: >> > http://sourceforge.net/mailarchive/message.php?msg_id=20516411, but it >> > was about creating an image. But that at least confirm that PNG8 in >> > graphicsmagick can support transparency.Also, http://tinypng.org/ was >> > able to do the same conversion but keeps the transparency intact, which >> > means this is doable. >> > >> > So what I'm doing wrong? Thank you in advance for you help.I can provide >> > test images if needed. >> > >> > Kenneth >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > This SF.net email is sponsored by Windows: >> > >> > Build for Windows Store. >> > >> > http://p.sf.net/sfu/windows-dev2dev >> > _______________________________________________ >> > Graphicsmagick-tools mailing list >> > Graphicsmagick-tools@... >> > https://lists.sourceforge.net/lists/listinfo/graphicsmagick-tools >> > ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev