Hi,
I need to convert a .png image to .xpm containing a RGB colorspace and keeping the transparency information of the .png image. The problem is the resulting .xpm file always contains only a blackwhite colorspace. But I need a RGB colorspace in the resulting .xpm file.
I am using ImageMagick 6.7.7-10 (ubuntu 12.10). The code I use to convert the image is:
convert -background none Contours.png Contours.xpm
I also tried to force the number of colors (-colors 256) and the colorspace (-colorspace RGB) without success.
I hope someone can help me with this problem,
Thanks.
Converting .png to .xpm with transparency and RGB colorspace
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting .png to .xpm with transparency and RGB colors
First, I sugget you upgrade to a more recent version of IM. That one is ancient.
Second, I know nothing about XPM format. But converting a PNG with transparency to XPM and back to PNG works fine with no options at all, and no visible colour change. However, the alpha becomes binary, ie on or off, and loses any graduation.
Second, I know nothing about XPM format. But converting a PNG with transparency to XPM and back to PNG works fine with no options at all, and no visible colour change. However, the alpha becomes binary, ie on or off, and loses any graduation.
Code: Select all
convert a.png x.xpm
convert x.xpm aa.png
snibgo's IM pages: im.snibgo.com
Re: Converting .png to .xpm with transparency and RGB colors
Your answer clarified the behavior of convert.
As you pointed out the xpm format only supports binary transparency. In my special case the image data only consist of black pixels and an appropriate alpha value. So converting this png image with 8bit transparency to xpm must result in a monochrome image.
Thanks for your help.
As you pointed out the xpm format only supports binary transparency. In my special case the image data only consist of black pixels and an appropriate alpha value. So converting this png image with 8bit transparency to xpm must result in a monochrome image.
Thanks for your help.