THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/10/2011 at 14:03, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform:
Language(s) : C++ ;
---------
Hy there,
I try to open a floating 32-Bit format bitmap and to store it again. I succeed in opening and storing, but the image-data seems to be altered. I guess, that comes from the not very clear construction of a MultipassBitmap.
My first attempt was to create a 1x1 Pixel MultipassBitmap and then call the Init(..) method to load the given Filename. This always returns "Out of Memory" (which of course is not the case).
I also tried allocating a bigger initial image, which shouldn't be necessary, as data is purged on a new Init.
So my second attempt is to load the image first into a BaseBitmap and then wrap it with a MultipassBitmap wrapper. But as I thought, the initial loading into a BaseBitmap seems lossy. So after storing, I have darker Colors.
Here is the final attempt:
// source and dest are valid Filenames
if ( !source.Content() || !dest.Content() || source == dest)
goto Error;
Bool ret = FALSE;
// Load image
IMAGERESULT res;
BaseBitmap *loader = NULL;
MultipassBitmap *bitmap;
Bool ismovie = FALSE;
// actually, we call here BaseBitmap::Init ...
res = MultipassBitmap::Init(loader,source, -1L, &ismovie,NULL);// load the bitmap into loader
if (res != IMAGERESULT_OK)
{
GePrintF("Could not load image ... exiting ...");
goto Error;
}
bitmap = MultipassBitmap::AllocWrapper(loader); // Now wrap it ...
if (!bitmap)
goto Error;
... right now .. do nothing here ...
// store the image
bitmap->Save(dest,FILTER_TIF,NULL,SAVEBIT_32b**chANNELS);
// Hahaaaa, I cant write 32-B-I-T-C-H-A-N-N-E-L-S here ... it will missinterprete the semantics :)
So, how do I correctly load a 32-Bit floating format image and store it again?
Thank you,
maxx