THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/03/2010 at 17:04, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 11.514
Platform:
Language(s) : C++ ;
---------
Hi Everyone,
I have a plugin that loads a 32 bit tif, but cannot save it as a 32 bit PSD file. Here's the body of the Execute method:
Bool
testPluginCmd::Execute(BaseDocument *doc)
{
String tifPath("~/rawtex/face_tg.tif");
String psdPath("~/rawtex/face_tg.psd");
BaseBitmap *psdSaver = BaseBitmap::Alloc();
if (!psdSaver || psdSaver->Init(tifPath) != IMAGE_OK)
{
GePrint("Fatal: could not load " + tifPath);
BaseBitmap::Free(psdSaver);
psdSaver = NULL;
}
GePrint("File " + tifPath + " is a");
if (psdSaver->GetBt() == 96)
{
// This prints out, so the file is properly loaded as 32 bits
GePrint(" 32-bit image");
}
else if (psdSaver->GetBt() == 48)
{
GePrint(" 16-bit image");
}
else if (psdSaver->GetBt() == 24)
{
GePrint(" 8-bit image");
}
else
{
GePrint("Cannot determine bit depth for loaded tif file: " + tifPath);
}
if (psdSaver && psdSaver->Save(psdPath, FILTER_PSD, NULL, 0) != IMAGE_OK)
{
GePrint("Fatal: could not convert " + tifPath + " to PSD file");
}
BaseBitmap *psdLoader = BaseBitmap::Alloc();
if (!psdLoader || psdLoader->Init(psdPath) != IMAGE_OK)
{
GePrint("Fatal: could not load " + psdPath);
BaseBitmap::Free(psdLoader);
psdLoader = NULL;
}
GePrint("File " + psdPath + " is a");
if (psdLoader->GetBt() == 96)
{
GePrint(" 32-bit image");
}
else if (psdLoader->GetBt() == 48)
{
GePrint(" 16-bit image");
}
else if (psdLoader->GetBt() == 24)
{
// This prints, the PSD file is 8 bit
GePrint(" 8-bit image");
}
else
{
GePrint("Cannot determine bit depth for loaded psd file: " + psdPath);
}
BaseBitmap::Free(psdLoader);
return TRUE;
}
When the plugin is executed, the tif file is properly loaded into the BaseBitmap and GetBt() returns 96, which indicates a 32 bit image.
When the BaseBitmap is saved as FILTER_PSD, the Save method returns IMAGE_OK, so BaseBitmap::Save is successfully writing the image.
However, when the saved PSD file is loaded, the GetBt method returns 24, indicating an 8 bit image. If the PSD file is loaded into PhotoShop, PhotoShop also reports an 8 bit image.
What am I donig wrong? Any help greatly appreciated, thanks!