Page 1 of 1

Problems with pfm's endian

Posted: 2010-05-18T16:31:53-07:00
by Carbon14
So, after actually managing to find someone with vs 2003 so I could get a compiled version of imagemagick with hdr enabled and finding the radiance installer and downloading the whole package for seemingly one tiny exe file (ra_ppm.exe) I am still running into problems.

I am attempting to use imagemagick to create chopped and changed pfm's for certain compiler, however imagemagick (or is it ra_ppm.exe) creates pfm files in the wrong endian and the "-endian" function seems to make no difference. Every other program seems to create the files with the opposite endian, however unfortunately the compiler I am guessing only works with one type, and it's the more common one. The header of a pfm file is apparently something like:

Code: Select all

pf
256
256
1
The last part is the endian, and for the life of me I cant seem to make it change

I am using something like this

Code: Select all

convert.exe -endian lsb image.hdr image.pfm
Is this wrong, or right? Does imagemagick support -endian when dealing with hdri?

Thanks for any assistance!

Re: Problems with pfm's endian

Posted: 2010-05-18T16:49:30-07:00
by fmw42
did you try

convert.exe image.hdr -endian lsb image.pfm

syntax in v6 IM is usually

convert input options output

see http://www.imagemagick.org/Usage/basics/#why

there are some exceptions, though

Don't know if this will make a difference here.

Re: Problems with pfm's endian

Posted: 2010-05-18T17:57:53-07:00
by Carbon14
Ok, I *think* I tried that, however I am not sure. I know I tried putting it at the start assuming it was an option for the exe, then tried at the end because I thought it might have been an option for the output file. But putting it as an option on the input seems a little counter intuitive somehow? As I said Ithink I tried all variants but I am not sure, that particular one I might have skipped :p

I am at college right now so cant check, but I will as soon as I get home, thanks for the response! :)

Re: Problems with pfm's endian

Posted: 2010-05-18T18:52:02-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.6.2-0 Beta available within 48 hours. Thanks.

Re: Problems with pfm's endian

Posted: 2010-05-18T20:35:07-07:00
by anthony
The PFM Image File Format is suposed to indicate the 'endian' of the binary data that follows the header by using a negative value instead of a positive value. IM should be made understand this directly, and not have to use the -endian setting at all.

This is documented in the PFM manpage.

On the other hand outputting/creating a PFM should be able to use the -endian setting. But I can understand if it doesn't.



What I find is a pain is that you can't create a ASCII only PFM type file format ('noraw' in NetPBM/PbmPlus terminology, or -compress none in IM parlance) That file format only seems to have 'binary' type formats :-(

Does anyone know of a Image File Format that can save ASCII floating point numbers?

Re: Problems with pfm's endian

Posted: 2010-05-18T20:59:17-07:00
by Carbon14
magick wrote:We can reproduce the problem you posted and have a patch in ImageMagick 6.6.2-0 Beta available within 48 hours. Thanks.
Does that mean that it indeed doesn't work? Thanks though, that seems like an extremely fast turnaround, very impressed with imageMagick!

anthony wrote:The PFM Image File Format is suposed to indicate the 'endian' of the binary data that follows the header by using a negative value instead of a positive value. IM should be made understand this directly, and not have to use the -endian setting at all.

This is documented in the PFM manpage.

On the other hand outputting/creating a PFM should be able to use the -endian setting. But I can understand if it doesn't.



What I find is a pain is that you can't create a ASCII only PFM type file format ('noraw' in NetPBM/PbmPlus terminology, or -compress none in IM parlance) That file format only seems to have 'binary' type formats :-(

Does anyone know of a Image File Format that can save ASCII floating point numbers?
Are you suggesting by default imageMagick does not figure out the endian on input pfm images? Because this is going to cause me more problems if I want to edit pfm's created by other apps with IM. Assuming the fix mentioned above doesn't fix the handling of input images as well? Since as I said earlier both photoshop and hdrshop seem to create pfm's with the opposite endian to IM. (appologies for not remembering whether that is msb or lsb, still not home yet so cant check)

Re: Problems with pfm's endian

Posted: 2010-05-19T00:39:45-07:00
by anthony
I don't know if it does, but if it gets fixed then it should be able to figure it out.