Page 1 of 1
OpenEXR and ImageMagick on Windows - how to include
Posted: 2009-08-26T14:43:08-07:00
by psychospiller
I am a newbie to building ImageMagick with Visual Studio on Windows and I am relying on anything I can find on the web to help me do this. I have managed to download ImageMagick 6.5.5 and followed the installation instructions and I now have this building and working on my PC. I have also managed to enable the HDRI support feature. However I cannot find a beginners guide to including OpenEXR read/write support, the info I have found talks about installing OpenEXR first then IM, or installing OpenEXR in the IM folder, but I cant find anything specific or aimed at the novice.
I find the EXR source setup procedure problematic in Visual Studio with it not being able to find certain .h files or links that dont appear to work, perhaps I am not doing things correclty, however there is a precompiled version of OpenEXR for VS2005 that I have downloaded, my question is, is this pre-compiled version suitable for use with IM and if so can someone tell me what exactly I am supposed to do with the files, where they are placed within the IM folder structure so that they are included during the build process.
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2009-08-26T15:15:20-07:00
by fmw42
You don't need HDRI to use OpenEXR images. The only reason for using HDRI is if you have images that have negative values or you need to keep floating point accuracy.
OpenEXR in IM only supports half format or 16-bits, as far as I know.
To use it, you have to install the OpenEXR delegate library and then recompile IM so that it recognizes that format. You can tell if it is installed if you type
convert -list configure
and look at the line
DELEGATES bzlib fftw fontconfig freetype gs jpeg jng jp2 lcms lqr openexr png tiff x11 xml zlib
if openexr is in the line, then it is installed and IM knows about it.
You don't even need OpenEXR format to do high definition image processing. If you compile IM as 16-bits or 32-bits that should be fine as it will permit images to be stored at 16 bits per channel or 32-bits per channel if you use compatible formats such as tif or pfm. It is the way you combine versions of the image that is relevant in terms of high, medium and low contrast.
You can do a google search on processing for high definition or HDR and get some techniques.
However there is nothing to prevent you from using openexr format images if you want.
I am not sure but I think they are log processed.
you can get the delegate library at
http://www.openexr.com/index.html
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2009-08-26T22:58:58-07:00
by psychospiller
Thanks for the detailed reply, let me explain what I am hoping to do with IM. I wish to take floating point TIFF files and resize and crop them maintaining their 32bits per pixel format. I also wish to use IM to convert some of these TIFFs to the OpenEXR format, saving them with PKZip compression, I understand this will be 16-bits half format. I may also need IM to convert an EXR file to TIFF format.
I can successfully build Q16 and Q32 versions of IM with or without HDRI, but I cant understand how to get IM to recognise or find OpenEXR. I know that EXR support is not in my IM builds as I have checked the delegates line and its not there, nor does .exr appear in the formats list.
It's the initial "install the OpenEXR delegate library" part that I dont understand or cant successfuly achieve due to my lack of knowledge with building C++ projects. I have downloaded two EXR source versions from the openexr.com, there are files for v1.4.0 and v1.6.1 and there is a precompiled version of 1.4.0 for use with Visual Studio 2005, I am using VS2008. I followed the OpenEXR instructions on how to build from source, but this falls over on my PC saying that it cannot locate some of the .h files. My limited experience is in C# programming so the requirements of C++ leave me more confused.
Is there a location within the IM folder structure, for example the VisualMagick folder that the precompiled OpenEXR lib and bin files should be located? Or is there a way to add a reference to the EXR VS project within the IM project?
Even if I can get the OpenEXR source to build on it own its just not clear to me how IM knows that the OpenEXR library is there.
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2009-08-27T07:25:53-07:00
by psychospiller
Maybe I am getting somewhere, i have managed to correctly build the OpenEXR 1.4.0 source files on my PC in VS2008 and the examples appear to run ok.
I have added #define MAGICKCORE_OPENEXR_DELEGATE line to the magic-config.h file in the configure solution.
I dont know if that is correct, now when i try and build the VisualStaticMT.sln I am prompted that exr.c cannot find <ImfCRgbaFile.h> which looks slightly more promising.
If I specify the path to this file eg <../../../openexr/IlmImf/ImfCRgbaFile.h> it then creates a host of "LNK2019: unresolved external symbol" errors during the build. Not being familiar with C++ can someone tell me how to 'link' or correctly reference the OpenEXR files to the IM project?
Thanks
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2009-08-27T08:41:55-07:00
by fmw42
How have you installed IM. If from source, then installiing openexr from source should work and put it in a correct location. Of course you have to reinstall IM after installing openexr (as I understand it or do it for safety as I know of no shortcut to just edit some file).
But if you have installed IM using some other package installer, then that package installer will need to install openexr. At least this is the case on the Mac using FINK or MacPorts to do the install as they put IM in some special folder and all delegates there as well.
So if IM is installed in one place and your delegates in another, then IM will not be able to find the delegate.
That is about all I know as I am not a sys admin nor a programmer.
Hopefully you may get some help from some of the PC users.
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2009-08-27T14:45:22-07:00
by psychospiller
Thanks again, hopefully a Windows C++ guru can advise me.
I have re-installed, or re built IM configure.sln and then the VisualStaticMT.sln as per the windows IM instructions, that after installing and building OpenEXR as per the OpenEXR instructions
I dont know what the 'correct' location for OpenEXR is, I currently have it at C:\openexr.
Both are built from source. Below is a typical error (i get loads of these) when trying to build the IM VisualStaticMT.sln
Code: Select all
Error 1 error LNK2019: unresolved external symbol _ImfHalfToFloat referenced in function _ReadEXRImage core_db_coders_.lib UTIL_convert
Google this gives me C++ code suggestions I really dont follow. Is there a way perhaps to debug the build process so I can see why its not finding these items ?
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2009-08-27T15:34:19-07:00
by fmw42
Do a normal manual install of openexr and IM from source. Then test with the command line in a terminal window to see that it works. If that does not work, then no point in progressing to C++.
see
http://www.imagemagick.org/script/insta ... hp#windows
sometimes you have to take baby steps!
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2010-03-29T05:09:44-07:00
by aliaNaguib
Hey,
I'm having trouble installing openEXR. When i build the solution, it gives me this error that it can't find some header files. Any help will be great.
I'm using Visual Studio 2008
Thanks,
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2010-03-29T10:33:48-07:00
by el_supremo
Which header files is it complaining about?
And what is the very first error message that the build process produces?
The build process first compiles the IlmImf project and then the post-build process for that project creates a whole bunch of .h files. If that project fails then everything after that fails. In my case I hadn't installed the zlib files properly and although the build was complaining about missing .h files, the important error was the first one that it couldn't find zdll.lib.
Pete
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2010-03-30T05:56:15-07:00
by aliaNaguib
Well, it can't find almost all of the header files.
The first error is:
fatal error C1083: Cannot open include file: 'ImathBox.h': No such file or director
Alia
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2010-03-30T08:38:18-07:00
by el_supremo
That should be in the Deploy\include directory.
Pete
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2010-03-31T01:05:45-07:00
by aliaNaguib
That's the crazy thing all of the header files that it can't find, actually exist in the Deploy\include folder. That's why i can't really understand why it can't be found !!
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2010-03-31T12:50:02-07:00
by el_supremo
When building IM, you have to modify the properties of the IM_MOD_exr project:
- in C/C++|General|Additional Include Directories, add the path to the Deploy include directory e.g. c:\Deploy\include
- in linker|General|Additional Library Directories, add the path to the Deploy library: c:\Deploy\lib\Release
- in linker|Input|Additional Dependencies, add zdll.lib, Imath.lib, IlmThread.lib, IlmImf.lib, Iex.lib, Half.lib
(Note that when you make changes to each of these properties you must select Apply or the change won't take effect)
Hope this fixes it.
Pete
Re: OpenEXR and ImageMagick on Windows - how to include
Posted: 2010-04-01T02:48:52-07:00
by aliaNaguib
Thank you so much for your help. I'll give it a try and hope it solves it.
Alia