Using ImageMagick-6.2.8
ImageMagick on UNIX relies on the environment variables MAGICK_TMPDIR or TMPDIR to work out where to put temporary files.
I have ImageMagick embedded in a larger program which reads this location from a configuration file for its own purposes. It's not practical to set it in the environment before the program is run.
Is there a way in the C API to set ImageMagick's temporary directory? (Looking at the 6.2.8 code I can't see that there is, so I guess this is as much a feature request as a question!)
setenv() is not portable.
Setting MAGICK_TMPDIR environment variable programatically?
Re: Setting MAGICK_TMPDIR environment variable programatically?
Try this:
- putenv("MAGICK_TMPDIR=/data");
Re: Setting MAGICK_TMPDIR environment variable programatically?
Indeed I've resolved this by using putenv(). Note though that it isn't portable either; Windows has a _putenv() with slightly different semantics, so I've had to write a (simple) wrapper.
It would still be nice for this to be abstracted by the ImageMagick API.
It would still be nice for this to be abstracted by the ImageMagick API.