Problems with pfm's endian

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
Carbon14

Problems with pfm's endian

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problems with pfm's endian

Post 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.
Carbon14

Re: Problems with pfm's endian

Post 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! :)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems with pfm's endian

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems with pfm's endian

Post 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?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Carbon14

Re: Problems with pfm's endian

Post 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)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems with pfm's endian

Post by anthony »

I don't know if it does, but if it gets fixed then it should be able to figure it out.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply