PDA

View Full Version : ImageMagick and QT



manojmka
4th April 2008, 11:53
Blob imageBlob;
image.magick("XPM");
image.write(&imageBlob);
const QByteArray imageData((char*)(imageBlob.data()));
(QPixmap(*this)).loadFromData(imageData);


I am using the ImageMagick for image manipulation and the above code crash on



const QByteArray imageData((char*)(imageBlob.data()));



Can someone help?

cgaal
4th April 2008, 15:03
I don't know anything about ImageMagick Blobs, but the QByteArray constructor that you're using is expecting a null-terminated string, and I suspect that Blob::data() does not provide that. You may want to try this QByteArray constructor:

QByteArray::QByteArray ( const char * data, int size )

manojmka
7th April 2008, 12:50
Thanks for your reply. It worked!!

Can someone tell me what dlls or files from ImageMagick to be supplied when deploying an application? It should not be necessary for user to install ImageMagick on his/her machine.

wysota
7th April 2008, 13:22
Run depends.exe on your binary. It will tell you about all required dependencies.

manojmka
8th April 2008, 06:52
Hi wysota,

thanks for the reply. That was the first thing I did. It is something specific to ImageMagick. The application is running but not showing up the images. If I keep the ImageMagick installed folder intact, everything works. As soon as I rename the installed folder, application does not show up the images.

Regards,
Manoj

wysota
8th April 2008, 08:44
It will tell you the actuall DLL files and their paths. Most probably it's just libMagick (magick.dll or libmagick.dll).

manojmka
8th April 2008, 09:47
You are right Wysota. It tells the dll names and I also include all those dlls with my deployment, then only the application runs. But does not show up the images!!

wysota
8th April 2008, 09:49
Maybe the problem is with Qt and not ImageMagick? Did you remember to deploy the image plugins with your application?

manojmka
8th April 2008, 09:59
Yes. I deployed plugins also. It seems to be a Image Magick problem only. As I already said, If I keep the installed Image Magick folder intact everything works. As soon as I rename that folder, application stops showing up the images.

wysota
8th April 2008, 10:03
Maybe there are some hardcoded paths there? How do you load ImageMagick? Through some plugin or you link against it compile-time?

manojmka
8th April 2008, 10:10
I am using compile time linking. Where are you talking to look into for hard coded paths?

Thanks for all your help wysota.

spud
8th April 2008, 10:14
After you load your program into Dependency Walker, select "Start profiling" (F7) to see which dlls are loaded dynamically at run time. That should give you an idea what your missing.

manojmka
8th April 2008, 10:19
I don't have this option in my utility (depends) installed with Visual Studio 6 and I did not get dependancy walker with Visual Studio 2005 installed on my machine.

wysota
8th April 2008, 10:31
You can download the dependency walker from the net. At least you could have some time ago...

spud
8th April 2008, 10:31
I got mine with the platform sdk. in "C:\Program Files\Microsoft Platform SDK\Bin\".
Or go to http://dependencywalker.com/

manojmka
8th April 2008, 10:38
Yes, I got the new utility installed and it tells some new things. :-)

The application needs some more dlls, and paths for all those dlls are hard coded in other Image Magick dlls. Even If I copy those dlls into my deployment folder, it does not work.

manojmka
10th April 2008, 14:30
Hi!

I am just stuck with this. I have tried every method to deploy Image Magick application.
(1) I downloaded and installed ImageMagick-6.4.0-4-Q16-windows-dll.exe. When I try to use the dlls from this, my application always search for the installed location of Image magick for module dlls and coders.
(2) I downloaded and installed ImageMagick-6.4.0-4-Q16-windows-static.exe. It has only lib files and they are very big in size. i don't want to build my application big for only Image Magick.
(3) I downloaded and compiled the windows source code for dynamic dlls keeping the #undef MAGICKCORE_INSTALLED_SUPPORT uncommented. It builds all the dlls, modules and xml files in visualmagick/bin folder. I tried to copy the dlls from this with my application. The application crashes!!
(4) I tried building the source code in static mode but this also creates the big libs which I am not much interested to use.

*Note*
I tried building my application with static libraries from Image Magick but it produces linker errors for all Image Magick functions.

Please help!!

Regards,
Manoj