With ImageMagick, for 24-bit color, append the output with PNG8:output convert input.png PNG8:output.png Here is info about my ImageMagick tool: Version: ImageMagick 7.0.8-42 Q16 x86_64 Ĭopyright: © 1999-2019 ImageMagick Studio LLCĭelegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma openexr png tiff webp xml zlib If there's a way to do so automatically with some command that's fine though. So I don't wanna manually distinguish between grayscale and colored images. I should add that I have a bash script that looks like this: #!/bin/bash Is there a way to prevent it from doing that? So my question is: how can I convert a grayscale image to indexed mode? What really gets me is that it starts out in RGBA mode like the color image, but for some reason it converts automatically to grayscale mode. The 4-bit colormap part checks out, but the grayscale part does not. INDEXED_IMGS/SHADOW.png: PNG image data, 8 x 8, 8-bit grayscale, non-interlaced However, when I run file INDEXED_IMGS/*.png I get INDEXED_IMGS/FLAME.png: PNG image data, 16 x 16, 4-bit colormap, non-interlaced Which is expected both images are in 8-bit RGBA mode (since that's the mode I created them in Photoshop). IMGS/SHADOW.png: PNG image data, 8 x 8, 8-bit/color RGBA, non-interlaced I ran file IMGS/*.pngand got IMGS/FLAME.png: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced For an image that had only grayscale colors, I ran that same command (with the filename changed obviously) but I got a warning: convert: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG 'INDEXED_IMGS/SHADOW.png' warning/png.c/MagickPNGWarningHandler/1748. I'm trying to convert some small PNG images from 32-bit color mode to indexed color mode.įor color images, I ran the command convert IMGS/FLAME.png INDEXED_IMGS/FLAME.png and it converted fine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |