Marlo Posted September 6, 2012 Share Posted September 6, 2012 Hello! So i have made an app that converts multiple images to a different type, colour and size using the library but have run into a couple of issues.So here is an example of the code I use to convert my images._FreeImage_LoadDLL(@ScriptDir&"\FreeImage.dll") _FreeImage_Initialise() For $I = 1 To $Example[0] _ProcessImage($ExampleInput[$I], $ExampleOutput) Next Func _ProcessImage($Input, $Output) $sFile = $Input $iTWidth = 600 $iTHeight = 800 $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $hImage = _FreeImage_LoadU($FIF, $sFile) $oWidth = _FreeImage_GetWidth($hImage) $oHeight = _FreeImage_GetHeight($hImage) $Ratio = $oWidth / $oHeight If $Ratio > 1 Then $hImage = _FreeImage_RotateClassic($hImage, 90) EndIf $hImage = _FreeImage_Rescale($hImage, $iTWidth, $iTHeight, $FILTER_BILINEAR) $hImage = _FreeImage_ConvertToGreyscale($hImage) _FreeImage_SaveU($FIF_PNG, $hImage, $Output, $PNG_Z_BEST_COMPRESSION) _FreeImage_Unload($hImage) EndFuncOkay so this actually works quite nicely and does exactly what i want it to but with 2 problems.1) FreeImage doesn't seem to dump the image from memory after each iteration resulting in huge RAM consumption (i usually convert about 400-600 images at a time)2) The filesize of the output files is usually bigger than the inputs despite being converted to grey-scale and scaled down in size. I would also like to somehow make the images crisper.If anyone can shed some light on this for me i would be appreciative Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2012 Share Posted September 6, 2012 I don't know anything about that library, but I'd certainly test any return values if I were having difficulty with it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Marlo Posted September 7, 2012 Author Share Posted September 7, 2012 I may have solved the memory leak by de-initialising the FreeImage lib after about 100 conversions yet still don't know how to reduce the file size. Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now