How do I use IM in a non-standard language

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
batvink

How do I use IM in a non-standard language

Post by batvink »

Hi,

first post, hopefully the first of many.

I use a language that lets me use DLLs in the following way:

LOAD DLL filename$
CALL DLL function$, [parameter1, parameter2...]

I can use any DLL function that is available in the exported table, and up to 9 parameters (integer, float, string). I can also return 1 parameter.

Can you tell me if this approach is compatible with IM, and if so which download I need. Ideally, I would like to simply include the dll in the installation directory, without the need to register it. This is a Windows based application.

Thanks in advance for your help!
batvink

Post by batvink »

Anyone able to offer any advice?
batvink

Post by batvink »

bump! :D
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

You might be able to use the MagickWand "wrapper".
Start by trying a simple program which just initializes IM and then closes it. Something like this:

Code: Select all

LOAD DLL "CORE_RL_wand_.dll"
CALL DLL "MagickWandGenesis"
CALL DLL "MagickWandTerminus"
I've assumed that you're using a static release version of ImageMagick that's in the current directory.

If that doesn't work you're probably dead in the water.

Next step would be to try to call one MagickWand function which returns a string and see if you can print out the string (I'm guessing at the syntax):

Code: Select all

LOAD DLL "CORE_RL_wand_.dll"
CALL DLL "MagickWandGenesis"
version = CALL DLL "MagickGetVersion"
CALL DLL "MagickWandTerminus"
print version$
If that works, you can try to read a builtin image file and write it out:

Code: Select all

LOAD DLL "CORE_RL_wand_.dll"
CALL DLL "MagickWandGenesis"
m_wand = CALL DLL "NewMagickWand"
if m_wand$ = 0 then NewMagickWand failed
err = CALL DLL "MagickReadImage",m_wand$,"logo:"
if err$ = 0 then the read failed
CALL DLL "MagickWriteImage",m_wand$,"logo_out.jpg"
CALL DLL "MagickWandTerminus"
If logo_out.jpg exists after all that then you should be able to use most of the MagickWand functions.

Pete
batvink

Post by batvink »

thanks for the help so far. I need to work on this, I have some issues:

1. It doesn't work with just the Magick Wand dll in the folder. Running the program in the install directory works, but I need to work out which files it is relying on.

2. The first example runs, I can initialise and end the Magick Wand API. calling the version function causes a crash. I tried returning an integer, float and string, but none of them worked.
Post Reply