Is this possible?
Any tutorial if possible?
I want to make a program to do mass conversion of my Icons without loosing resolution

Recommended Answers

All 2 Replies

I don't think PIL can do this. The XPixelMap format is a text based C array and you could probably take bitmap information and create this array and save it. Presumably there are C utilities around that create XPM files, you should be able to run those from within Python.

One of the free picture programs that batch converts to and from the XPM format is PhotoMania from:
http://wareseeker.com/download/photomania-dx-6.73.rar/418074

Here is an example of a 5x5 red dot in XPM format ...

/* XPM */
static char * dot[] = {
"5 5 2 1",
". c None",
"X c Red",
"  X  ",
" XXX ",
"XXXXX",
" XXX ",
"  X  ",
};

Since it's text based, one can simply change the array element
"X c Red"
to
"X c Blue"
and get a blue dot.

BTW, PIL can read XPM files but not write them.

Since It cannot do it, thread closed
Thanks Vega

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.