Harish
Harish

Reputation: 1408

Performance and Memory wise is JPG or PNG better for Core Image?

The title pretty much sums up the question but I was wondering if JPG/PNG files have a notable difference in speed and performance when using CIFilters. Is using one type of file preferred over the other? Is there another file type that could be potentially faster than both JPG and PNG?

Upvotes: 0

Views: 2966

Answers (2)

user3344003
user3344003

Reputation: 21617

  1. JPEG and PNG are storage mechanism. Filters have to be performed on uncompressed data, not on JPEG or PNG streams.

  2. The speed difference between JPEG and PNG occurs reading or writing. PNG compression generally is slower than JPEG compression. PNG expansion is generally faster than JPEG.

  3. JPEG is not suitable for images that have abrupt changes in color, e.g. drawings, cartoons.

  4. JPEG is not suitable for images that are stored, retrieved, modified, stored . . . . Each cycle changes the image.

  5. JPEG generally produces much smaller compressed streams than PNG.

Upvotes: 3

Theo Strauss
Theo Strauss

Reputation: 1351

It actually depends! PNG's are better if it is a smaller image, as it cuts away the white surrounding what is actually there. But, it does not compress at all to maintain quality. This could slow down performance. JPEG compresses, therefore cutting down file size, but also compromising quality to a point. I'd say go for JPEG if it is a huge image for the app, but go for PNG if you want quality.

Thanks for asking and hope this helps. If this answers your question, I'd love if you could just hit that check mark.

Cheers, Theo

Upvotes: 1

Related Questions