Hello everyone.
Is there some way to interrogate MagickWand (in c/c++) to find out which file types or file extensions are supported?
For the life of me, I'm not seeing that in the API.
Programmatically finding file support.
Re: Programmatically finding file support.
You can call MagickSetImageFormat() and if it returns MagickFalse, the image format is not recognized or not supported. You can also call the MagickCore API method GetMagickInfo(). If it returns a non-null result, the image format is recognized and supported by ImageMagick.
Re: Programmatically finding file support.
Thanks for the response.
So you are saying that the only way I can get a complete set of file formats is to call 'MagickSetImageFormat' for every 2-4 letter combination of letters and numerals? There isn't any way to get back a simple list of what's supported?
regards.
So you are saying that the only way I can get a complete set of file formats is to call 'MagickSetImageFormat' for every 2-4 letter combination of letters and numerals? There isn't any way to get back a simple list of what's supported?
regards.
Re: Programmatically finding file support.
You can get a list of all supported image formats with a MagickCore API call:
- p = GetMagickInfo("*",exception);
Re: Programmatically finding file support.
Ah well...bummer.
It works fine, according to Visual Studio it's loading a whole slew of *.dll's (things like IM_MOD_RL_tga_.dll), and then it gets up to
'IM_MOD_RL_xtrn_.dll'', and then blammo:
First-chance exception at 0x048decd5 in test.exe: 0xC0000005: Access violation reading location 0x00000014.
Unhandled exception at 0x048decd5 in test.exe: 0xC0000005: Access violation reading location 0x00000014.
No biggie, I'll just have to have a list of file types in my own application. It's less elegant but should work fine.
It works fine, according to Visual Studio it's loading a whole slew of *.dll's (things like IM_MOD_RL_tga_.dll), and then it gets up to
'IM_MOD_RL_xtrn_.dll'', and then blammo:
First-chance exception at 0x048decd5 in test.exe: 0xC0000005: Access violation reading location 0x00000014.
Unhandled exception at 0x048decd5 in test.exe: 0xC0000005: Access violation reading location 0x00000014.
No biggie, I'll just have to have a list of file types in my own application. It's less elegant but should work fine.
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Programmatically finding file support.
FYI: This C function works fine on my Win XP system using IM 6.6.3-9
It writes the list of 208 formats into the file "formats.txt".
Pete
It writes the list of 208 formats into the file "formats.txt".
Pete
Code: Select all
#include <windows.h>
#include <magick/MagickCore.h>
void test_wand(void)
{
ExceptionInfo *exception;
const MagickInfo **mi_ptr = NULL;
size_t num_ptr;
size_t i;
FILE *fdo = NULL;
MagickCoreGenesis((char *) NULL,MagickFalse);
// Get and Initialize an exception info
exception = AcquireExceptionInfo();
GetExceptionInfo(exception);
mi_ptr = GetMagickInfoList("*",&num_ptr,exception);
if(mi_ptr == NULL) {
MessageBox(NULL,"NULL list returned","",MB_OK);
} else {
fdo = fopen("formats.txt","w");
for(i=0;i<num_ptr;i++) {
fprintf(fdo,"%s\n",mi_ptr[i]->name);
}
fclose(fdo);
}
DestroyExceptionInfo(exception);
MagickCoreTerminus();
}
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See my message in this topic for a link to a zip of all the files.
Re: Programmatically finding file support.
Many thanks, that's exactly what I needed to know. It works now.