Memory leak with JPEG, not with PNG

My application is designed to save some user photos in a PDF file to send the file by email. To create a small pdf size, I want to compress my images in jpeg. When I draw jpeg in the context of the PDF, the PDF is really much smaller than when I use PNG, but it uses JPEG leaks.

For my debugging, I added a jpeg and png file to the project.

The following call leaks:

UIImage * destImage = [UIImage imageNamed:@"Image.JPG"];
[destImage drawInRect:drawingFrame];

whereas this is not:

UIImage * destImage = [UIImage imageNamed:@"Image.png"];
[destImage drawInRect:drawingFrame];

Is there something I am missing? Is this a problem of knowledge?

I’m thinking of a workaround that will consist of using PNG representations of my images and setting a specific compression option for the generated pdf file, but did not find this in the sdk SDD formation.

Do you have an idea? Thanks in advance.

+3

Source: https://habr.com/ru/post/1794292/


All Articles