开发者

Packaging an application that uses the ImageMagick C API

开发者 https://www.devze.com 2023-01-03 19:56 出处:网络
I\'ve created a little Windows app that uses the ImageMagick C API but have run into a bit of a brick wall. The app works fine and I\'m ready to share it with a few others in our organisation but I ca

I've created a little Windows app that uses the ImageMagick C API but have run into a bit of a brick wall. The app works fine and I'm ready to share it with a few others in our organisation but I can't find documentation on distributing such an app without installing ImageMagick on the target machine.

Does anyone here have information, or a link to information, that details how to package this up for distribution? What DLLs are required and which one(s) need to registered with Windows? The target users will be on a mi开发者_C百科x of XP and Win7.


I had to do something similar, though I built Imagemagick myself so I could trim the fat. What you can do is on your machine, install the dlls using the exe they provide. In the install process, make sure you check the box that says install C and C++ development headers and libraries.

The install dir will then contain the headers in the include directory, and dlls throughout the tree. You will find libs that you need to link against in lib. There are a ton of dlls though, which makes this a bit of a problem.

What I ended up doing when I built was just create a single ImageMagick dll and a .lib file to link against. I created my own project from the source and built a dll. Then you can ship the dll and the lib you create with the headers from source.

EDIT: I should also state that the install process only occurs on your machine. You can then copy the dlls/libs/headers from the install path and ship them with your package, rather than requiring the user to install anything but your app.


Never found a solution either so here's what i found out:

Using imageMagikNet.dll and (underlying) imageMagik dlls, seem these lib needs some registry keys to run properly.

Here is my packaging of ImageMagikNet application that works...

  1. ImageMagickNET.dll(http://imagemagick.codeplex.com/) compiled against 6.5.3-10
  2. All CORE_RL*.dll from the installation of ImageMagik 6.5.3-10 (ImageMagick-6.5.3-10-Q16-windows-dll.exe)
  3. All IM_MOD_RL*.dll from the installation of ImageMagik 6.5.3-10(ImageMagick-6.5.3-10-Q16-windows-dll.exe)
  4. All *90.dll from the installation of ImageMagik 6.5.3-10(ImageMagick-6.5.3-10-Q16-windows-dll.exe)
  5. x11.dll from the installation of ImageMagik 6.5.3-10

  6. A registry Key that looks like the following:

    [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick]

    [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick\6.5.3]

    [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick\6.5.3\Q:16] "BinPath"="[TARGETDIR]" "LibPath"="[TARGETDIR]" "CoderModulesPath"="[TARGETDIR]"

    [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick\Current] "Version"="6.5.3" "QuantumDepth"=dword:00000010 "BinPath"="[TARGETDIR]" "LibPath"="[TARGETDIR]" "CoderModulesPath"="[TARGETDIR]"

I Know that might not be a clean way to go since i simulate an installation of imageMagik in the registry and i don't know how it will work if a client intall ImageMagik on his machine, but so far, that's the only way i found.

My .net app use ImageMagik only to crop images.

Hope it helps...


I can suggest two methods:

  1. Use static libraries (binaries available on ImageMagick site) and compile your application using those (might not be feasible if your application is in .NET or similar)
  2. Check which DLLs are loaded by your application and put them in the same directory as executable during installation/unpacking, since Windows always includes current directory in its search for DLLs
  3. You can, in theory, play with SxS and make your package register the libraries with SxS store and have your application depend on them. While I'm personally an advocate of SxS, I suspect it would bring unnecessary complication given that ImageMagick team doesn't seem to have SxS version by themselves, reducing the value gained from using SxS (which is DLL sharing)


As well as packaging all of the binary files and modules folder, you can simply set the MAGICK_CODER_MODULE_PATH and MAGICK_FILTER_MODULE_PATH environment variables, no need to make registry entries.

See module.c in ImageMagick source code, function GetMagickModulePath.


From the description on this page, it looks like the last Windows package listed, ImageMagick-6.6.2-Q16-windows.zip, is packaged without an installer, and is intended for use with applications that want to do their own installation and distribution. This sounds closest to what you're looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号