ofImage.saveImage() - ofImage.setFromPixels() = wrong colors

Hi there,

I’m using ofVideoGrabber.getPixels() togother with ofImage.setFromPixels() to write an image of a webcam back to an image file but the colors appear too blue / inverted.

Can someone tell me why? and how I can fix this?


hmm – what platform are you on? (ie, mac intel, etc)

I don’t know, but set from pixels take a fourth boolean parameter which is by default RGB:

void setFromPixels(unsigned char * pixels, int w, int h, int newType, bool bOrderIsRGB = true);

you can try passing in “false” or “true” to the last parameter and seeing a change. if the pixels are coming from a videoGrabber they should be RGB so it should work without that parameter, but you can try seeing if either true or false helps.

I hope that helps -
take care!

Don’t know why, but I restarted the thing and it works now!
Thanks for your reply!