I’ve taken my ofImage modifications and packaged them as an addon - ofxImage.
New functionality/methods: mirror - mirror the image pixels horizontally and/or vertically rotate - rotate the image pixels by an arbitrary angle getFileName - get the fileName the image was loaded or saved to setFileName - set a fileName that the image will load or save to
Overloaded/modified methods: loadImage - loads the image, and stores fileName OR if fileName parameter is omitted, loads the image from fileName set with setFileName saveImage - saves the image, and stores fileName OR if fileName parameter is omitted, saves the image to fileName set with setFileName
and now it works for me as it rotate the content of the image inside the size of the image (content at the corner makes unexpected behaviour) and that’s what I want.
ya… there are a few rotation functions available from FreeImage. Ideally I’d like to implement something that uses the RotateEx, and then replaces the black corners with transparent pixels.
I was working on a formula for calculating exactly where the black corners would be, but haven’t really needed it for a project yet so haven’t’ spent a lot of time.
seems to have compile errors against the github OF due to swapRgb in saveImageFromPixels. i’ve run into this before, i can’t remember what the issue is. but i’ve commented it out for now.
Basically it is because swapRgb is defined as a protected static inline method in ofImage. I guess the new compiler settings don’t allow it to be available to extended classes.
The solution we used was to copy the swapRgb method from the ofImage into the ofxImage class.
It seems strange that this needs to be done, but it at least solves the problem
I know this is 8 years old, but this code doesn’t work (getPixels() just says “it’s your job to get this to work” ) and I can’t find any other solutions to getting ofImage to rotate.
Any chance someone can link a working solution, or somebody update this?
It seems silly that after 8 years, ofImage STILL doesn’t have the ability to rotate less than 90 deg
Correction
I am dumb.
To anyone of the future who manages to find this link in the same desperate search I did, there is an official addon for open frameworks now.
Use this