How do I change or set the variable name while generating a XPM file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Joel
Posts: 1
Joined: 2017-11-24T11:27:34-07:00
Authentication code: 1152

How do I change or set the variable name while generating a XPM file

Post by Joel » 2017-11-24T11:37:14-07:00

Hi:

I'm using IM to convert BMP to XPM, but I'd like to able to set the variable string something like:

Code: Select all

const char* folder_xpm[xxx] // the rest of the string
As you can see I only need to add const and prepend _xpm. Right now I have to open the file and edit it my self,any ideas?

Jason S
Posts: 96
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: How do I change or set the variable name while generating a XPM file

Post by Jason S » 2017-11-26T09:43:58-07:00

As of v7.0.7-11, the pattern "static char *...[] = {" is hardcoded, and cannot be changed. The "..." is the "base output filename", and I don't see any way to set it independently.

There must be many ways to automate the editing that you say you're doing manually. In a Unix-like environment, you could use "sed".

If you're #including the XPM file in a C/C++ program (and why else would you use XPM?), maybe you could even do it with some horrible preprocessor hack, like:

Code: Select all

const
#define folder folder_xpm
#include "folder.xpm"
#undef folder

Post Reply