I was having wild fluctuations in the quality of my photos when using the Jason’s function to convert an image to a memory block on IOS. Turns out there is a compression parameter that was not included in the original function. I made the below modifications and it cleaned up the photos coming out of the routine.
[code]Declare function UIImageJPEGRepresentation lib UIKitLib (obj_id as ptr,compressionQuality As CGFloat) as ptr
dim d as new Foundation.NSData(UIImageJPEGRepresentation(image.Handle,.75))
dim mb as Xojo.Core.MemoryBlock
mb = d.DataMb
return mb
[/code]
compressionQuality
The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality).
Here is a link to Apple’s docs on this function where I found the compressionQuality parameter.
https://developer.apple.com/documentation/uikit/1624115-uiimagejpegrepresentation?language=objc