How to display raw rgb 32 bits floating-point images ?

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
noteed

How to display raw rgb 32 bits floating-point images ?

Post by noteed »

Hi,

I generate a file with 200*100 "pixels" written as follow (in C) :

/* red */
float red = 1.0f;
fwrite (&red, sizeof(float), 1, file);
/* same for green and blue */

I'd like to display the file but I just get a black picture.
Say the file is named rbg.out, I use the following command :

display -size 200x100 -depth 32 -define quantum:format=floating-point rgb:out.rgb

I use ImageMagick 6.4.3.

What's wrong ?

Thanks a lot.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to display raw rgb 32 bits floating-point images ?

Post by magick »

Try this command:
  • display -size 200x100 -depth 32 -define quantum:format=floating-point -define quantum:scale=65536.0 -endian lsb out.rgb
noteed

Re: How to display raw rgb 32 bits floating-point images ?

Post by noteed »

It works, thanks a lot!

But, I don't find the documentation for quantum:scale or -endian on imagemagick.org,
where is it ?

Thank you again.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to display raw rgb 32 bits floating-point images ?

Post by magick »

The command line we provided is a temporary fix. You should not need quantum:scale or -endian in your command line and we have applied a patch to ImageMagick to fix the problem for the next release.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: How to display raw rgb 32 bits floating-point images ?

Post by el_supremo »

@magick: should the scale be 65536 or 65535?
and for a Q8 IM, should it be 255.0 or 256.0?

Pete
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to display raw rgb 32 bits floating-point images ?

Post by magick »

Right. 255 for Q8, 65535 for Q16. However, the latest Subversion trunk patch removes the need to specify the scale.
Post Reply