Problem converting grayscale PNG to XPM
Posted: 2013-10-14T06:06:42-07:00
I have some icons in PNG format and many of them are greyscale with transparency. They are entirely compatible with ImageMagick and I've run them through mogrify which saved them as "grayscale+alpha". Here is an example:
http://nartowicz.webspace.virginmedia.com/vcard.png
When I attempt to mogrify these to XPM files, a bizarre file is created like this:
http://nartowicz.webspace.virginmedia.com/vcard.xpm
It apparently has a full palette, but everything colour is black, except for the first pixel. Although it conforms to the basic XPM file format, it does not represent the icon image from the PNG file. It can be displayed, but is entirely black except for the first pixel. mogrify to XPM works on those icons that are saved in an RGB PNG format, but forcing the PNG file into RGB format before converting to XPM doesn't help, it is still saved in the odd format.
Verbose output is:
http://nartowicz.webspace.virginmedia.com/vcard.png
When I attempt to mogrify these to XPM files, a bizarre file is created like this:
http://nartowicz.webspace.virginmedia.com/vcard.xpm
It apparently has a full palette, but everything colour is black, except for the first pixel. Although it conforms to the basic XPM file format, it does not represent the icon image from the PNG file. It can be displayed, but is entirely black except for the first pixel. mogrify to XPM works on those icons that are saved in an RGB PNG format, but forcing the PNG file into RGB format before converting to XPM doesn't help, it is still saved in the odd format.
Verbose output is:
Code: Select all
vcard.png PNG 16x16 16x16+0+0 8-bit DirectClass 107B 0.000u 0:00.000
vcard.png=>vcard.xpm PNG 16x16 16x16+0+0 8-bit PaletteBilevelAlpha PseudoClass 256c 4.1KB 0.000u 0:00.000