Skip to content

Instantly share code, notes, and snippets.

Created July 12, 2011 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1077928 to your computer and use it in GitHub Desktop.
Save anonymous/1077928 to your computer and use it in GitHub Desktop.
ofImage_gif_grayscale problem
Seems to have something to do with this:
if (fif == FIF_GIF) {
FIBITMAP* convertedBmp;
if(pix.getImageType() == OF_IMAGE_COLOR_ALPHA) {
// this just converts the image to grayscale so it can save something
convertedBmp = FreeImage_ConvertTo8Bits(bmp);
} else {
// this will create a 256-color palette from the image
convertedBmp = FreeImage_ColorQuantize(bmp, FIQ_NNQUANT);
}
bool success = FreeImage_Save(fif, convertedBmp, fileName.c_str());
if (convertedBmp != NULL){
FreeImage_Unload(convertedBmp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment