Notifications
Clear all
[Closed] Gamma issues when open/resize/save a image [c++]
Sep 07, 2016 1:30 pm
As starting point just say that it only happens if gamma correction is enabled on preferences, I tried to disable it programatically but wihtout luck:
bool gammaenabled = gammaMgr.IsEnabled();
float fileingamma = gammaMgr.GetFileInGamma();
float fileoutgamma = gammaMgr.GetFileOutGamma();
gammaMgr.SetFileInGamma(1.0f);
gammaMgr.SetFileOutGamma(1.0f);
gammaMgr.Enable(false);
gammaMgr.enable = false;
Being this kind of ‘features’ more or less common on 3dsmax I tried to change the gamma by myself using custom gamma:
BitmapInfo bi_input = BitmapInfo(myfile);
bi_input.SetCustomFlag(BMM_CUSTOM_FILEGAMMA);
bi_input.SetCustomGamma(1.0f);
BMMRES status;
Bitmap *bm = TheManager->Load(&bi_input, &status);
Of course I tried on output file too but without luck.
The intention is just to resize an image and save the resized copy I left the code here just for anyone that could considere this useful:
BitmapInfo bi(bi_input);
bi.SetType(BMM_TRUE_32);
bi.SetWidth(newWidth);
bi.SetHeight(newHeight);
bi.SetPath(outputfile);
Bitmap *outbm = TheManager->Create(&bi);
BMM_Color_fl fc;
outbm->CopyImage(bm, COPY_IMAGE_RESIZE_HI_QUALITY, fc, &bi);
outbm->OpenOutput(&bi);
outbm->Write(&bi);
outbm->Close(&bi);
Any idea?