For color images, I ran the command
Code: Select all
convert IMGS/FLAME.png INDEXED_IMGS/FLAME.png
Code: Select all
convert: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG `INDEXED_IMGS/SHADOW.png' @ warning/png.c/MagickPNGWarningHandler/1748.
Code: Select all
file IMGS/*.png
Code: Select all
IMGS/FLAME.png: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced
IMGS/SHADOW.png: PNG image data, 8 x 8, 8-bit/color RGBA, non-interlaced
Code: Select all
file INDEXED_IMGS/*.png
Code: Select all
INDEXED_IMGS/FLAME.png: PNG image data, 16 x 16, 4-bit colormap, non-interlaced
INDEXED_IMGS/SHADOW.png: PNG image data, 8 x 8, 8-bit grayscale, non-interlaced
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. Is there a way to prevent it from doing that?
I should add that I have a bash script that looks like this:
Code: Select all
#!/bin/bash
for img in IMGS/*.png; do
file=$(basename $img)
convert $img INDEXED_IMGS/$file
done
Here is info about my ImageMagick tool:
Code: Select all
Version: ImageMagick 7.0.8-42 Q16 x86_64 2019-04-24 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma openexr png tiff webp xml zlib