Comments (2)
Looking at the FreeImage documentation it looks like you need to call the FreeImage_Unload function to avoid leaks.
Maybe something like this:
FIBITMAP* ReOrient(FIBITMAP *bitmap) {
FITAG *tagValue = NULL;
FIBITMAP *newBitmap;
FreeImage_GetMetadata(FIMD_EXIF_MAIN, bitmap, "Orientation", &tagValue);
switch (tagValue == NULL ? 0 : *((short *) FreeImage_GetTagValue(tagValue))) {
case 6:
newBitmap = FreeImage_RotateClassic(bitmap, 270);
break;
case 3:
newBitmap = FreeImage_RotateClassic(bitmap, 180);
break;
case 8:
newBitmap = FreeImage_RotateClassic(bitmap, 90);
break;
default:
newBitmap = FreeImage_Clone(bitmap);
break;
}
FreeImage_Unload(bitmap);
return newBitmap;
}
The Documentation can be found here: http://iweb.dl.sourceforge.net/project/freeimage/Source%20Documentation/3.15.4/FreeImage3154.pdf
Page 12 of the document has the unload method (page 16 of the pdf).
EDIT: I just tested this code using the original script and it seems to work without leaking memory.
from image_science.
I sent a pull request after testing this with eomernick. See #17
from image_science.
Related Issues (14)
- Jpg compression HOT 2
- ENV['INLINEDIR'] can't be relative HOT 1
- EXIF orientation problems HOT 6
- inline file not changed after upgrade HOT 7
- Cropping an png image modifies background and transparency HOT 6
- raising error on warnings HOT 10
- [PATCH] defer raising exception until wrapped by rb_ensure HOT 1
- Is this gem still supported? HOT 3
- Remove relative paths? HOT 1
- Errors compiling under 1.9.3-preview1 HOT 7
- Add RubyInline as a dependency HOT 1
- test_class_with_image_missing_with_img_extension fails HOT 2
- Broken documentation link HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image_science.