What does the Magick::InitializeImageMagick function supposed to do ? Why is it necessary to call this function and what should be the parameter which it takes ?
I have called this function in a console application passing it the directory where my ImageMagick DLLs reside only to be met by a "no decode delegate for this image format" exception when I try to instantiate an Image object using a JPEG image. If I do not call this function, instantiate the Image object works with no problems.
Magick++ InitializeImageMagick function
Re: Magick++ InitializeImageMagick function
You can use the InitializeMagick() method to set a path where ImageMagick will look for its coder modules and configuration files. Set the parameter to NULL and ImageMagick will use the default paths set at build time.
Re: Magick++ InitializeImageMagick function
I thank you for your answer but the call to Magick::InitializeMagick is still quite confusing to me, and is causing some serious problems in a program. Below I give the reasons:magick wrote:You can use the InitializeMagick() method to set a path where ImageMagick will look for its coder modules and configuration files. Set the parameter to NULL and ImageMagick will use the default paths set at build time.
The binary distribution puts the coder modules and the configuration XML files in separate directories. They appear to be two separate conceptual entities. Are they meant to always be combined in a single directory in order to satisfy the single Magick::InitializeMagick call ?
I am building from source, which does put the coder modules and configuration files in the same directory. What are the "default paths set at build time" in that scenario ?
Does the MAGIC_CONFIGURE_PATH, set to where the XML configuration files exist, affect the need to call Magick::InitializeMagick ?
Finally how does the ProvideDllMain macro affect the need to call Magick::InitializeMagick ?
I ask these questions because of the difficulty I am having with Magick::InitializeMagick in an application which is using Magick++.
1) I get a ""No decode delegate for this image format" exception when first making the Magick::InitializeMagick call and then trying to read in a JPEG file using Magick::Image::Image("ajpegfile.jpg").
2) I get a crash using the Magick::Image::magick() function when I do not make the call.
3) Everthing runs fine when I do not make the call and do not call the Magick::Image::magick() function. However I need the Magick::Image::magick() function to test for a valid type of image file which my application handles.
Re: Magick++ InitializeImageMagick function
ImageMagick has two types of builds, "installed" and "uninstalled". The installed version looks in fixed locations such as /usr/local/lib/ImageMagick/modules-Q16/coders for its coders (e.g. png.so) and in /usr/local/lib/ImageMagick/config/ for its configuration files (e.g. type.xml). For the uninstalled version, ImageMagick looks for its coders/configuration files relative to MAGICK_HOME or in the executable path or the path defined by the InitializeMagick() method. You can check where ImageMagick is looking by setting the environment variable MAGICK_DEBUG to "configure" or for more details "all". If debugging does not provide you with the answer you are looking for, post a simple program and exactly what you are looking for and how it currently fails to meet your expectations and we'll try to come up with a solution. Also post source we can download and compile and run to reproduce any crashes you have. ImageMagick should never crash and should always throw exceptions instead.
Re: Magick++ InitializeImageMagick function
I am using the "uninstalled" build.magick wrote:ImageMagick has two types of builds, "installed" and "uninstalled". The installed version looks in fixed locations such as /usr/local/lib/ImageMagick/modules-Q16/coders for its coders (e.g. png.so) and in /usr/local/lib/ImageMagick/config/ for its configuration files (e.g. type.xml). For the uninstalled version, ImageMagick looks for its coders/configuration files relative to MAGICK_HOME or in the executable path or the path defined by the InitializeMagick() method. You can check where ImageMagick is looking by setting the environment variable MAGICK_DEBUG to "configure" or for more details "all". If debugging does not provide you with the answer you are looking for, post a simple program and exactly what you are looking for and how it currently fails to meet your expectations and we'll try to come up with a solution. Also post source we can download and compile and run to reproduce any crashes you have. ImageMagick should never crash and should always throw exceptions instead.
What is the relative path off of MAGICK_HOME where Imagemagick is looking for its coders ? I have MAGICK_CONFIGURE_PATH set so that it can find the configuration files.
How does MAGICK_DEBUG work ? Does it write out a file of information somewhere telling me where it is looking for things ? I can find nothing on the ImageMagick site about this when I do a search.
Perhaps the documentation about these things exist somewhere and you can point me to them but I honestly can not find them anywhere.