Create and save 32-Bit tif picture with magick++
Posted: 2008-12-09T11:27:33-07:00
Hello developers,
I have little question:
I simply want to create and save a 32-bit tif picture(Gray), set some pixels, save it and find these pixels in the resulting image(for further calculations).
Environment:ImageMagick 6.4.8 with QDepth 32 and HDRI and Visual Studio.
Now I use:
list<Image> imageList;
readImages( &imageList,"image.tif" );
Quantum value=0.84;
for(..){
imageList.front().pixelColor(posX,posY,Color(value,value,value));
}
writeImages( imageList.begin(), imageList.end(), "image_done.tif" );
Two things are dissappointing:
1. It only works when I create a 32-bit tif image by another software, save this image, and load it with IM.
When I use "Image image(Geometry(sizeX,sizeY), Color(MaxRGB,MaxRGB,MaxRGB,0));" to dynamically configure the size, the values of the pixels are totally wrong(I guess result of some scaling processes).
I want to create the image with IM rather than with another image program.
2. Due to QDepth 32 and HDRI the values set by "pixelColor" seem to be scaled before putting into the image.I (thought I) proudly found out that with a multiplication of these values by "pow(2.0,32)" the "real" value will be written into the image-file.
Today I found out that some values (for example 0.84 and some more) are written as wrong stuff like -6,8734e8 into the file and
I have absolutely no idea why (btw. -0.84 works!!!)!
The reason might be related to those scaling processes, too.
Maybe somebody understands this phenomenon.
Thanks for every suggestion!
I have little question:
I simply want to create and save a 32-bit tif picture(Gray), set some pixels, save it and find these pixels in the resulting image(for further calculations).
Environment:ImageMagick 6.4.8 with QDepth 32 and HDRI and Visual Studio.
Now I use:
list<Image> imageList;
readImages( &imageList,"image.tif" );
Quantum value=0.84;
for(..){
imageList.front().pixelColor(posX,posY,Color(value,value,value));
}
writeImages( imageList.begin(), imageList.end(), "image_done.tif" );
Two things are dissappointing:
1. It only works when I create a 32-bit tif image by another software, save this image, and load it with IM.
When I use "Image image(Geometry(sizeX,sizeY), Color(MaxRGB,MaxRGB,MaxRGB,0));" to dynamically configure the size, the values of the pixels are totally wrong(I guess result of some scaling processes).
I want to create the image with IM rather than with another image program.
2. Due to QDepth 32 and HDRI the values set by "pixelColor" seem to be scaled before putting into the image.I (thought I) proudly found out that with a multiplication of these values by "pow(2.0,32)" the "real" value will be written into the image-file.
Today I found out that some values (for example 0.84 and some more) are written as wrong stuff like -6,8734e8 into the file and
I have absolutely no idea why (btw. -0.84 works!!!)!
The reason might be related to those scaling processes, too.
Maybe somebody understands this phenomenon.
Thanks for every suggestion!