2

My app requires that each user has a profile picture of around 140*140px. Right now I am using jpgs, I am wondering if performance wise it will be better to use pngs. I read pngs are good for small UI elements and images, jpg for large images with detail such as photos. Obviously my profile pics are photos but they are small. Would it make much difference switching to png? Thanks

Kex
  • 8,023
  • 9
  • 56
  • 129

3 Answers3

5

JPEG is best for small file sizes of photos, even for low resolutions.

PNG makes sense when there are many pixels of the exact same color next to each other. This is not the case with photos.

Nikolai Ruhe
  • 81,520
  • 17
  • 180
  • 200
1

These should be helpful for you.

When to use PNG or JPG in iPhone development?

PNG vs. GIF vs. JPEG vs. SVG - When best to use?

Community
  • 1
  • 1
nevra
  • 418
  • 1
  • 7
  • 21
1

Apple optimizes PNG images that are included in your iPhone app bundle. In fact, the iPhone uses a special encoding in which the color bytes are optimized for the hardware. XCode handles this special encoding for you when you build your project. So, you do see additional benefits to using PNG's on an iPhone other than their size consideration. For this reason it is definitely recommended to use PNG's for any images that appear as part of the interface (in a table view, labels, etc).

As for displaying a full screen image such as a photograph you may still reap benefits with PNG's since they are non-lossy and the visual quality should be better than a JPG not to mention resource usage with decoding the image. You may need to decrease the quality of your JPG's in order to see a real benefit in file size but then you are displaying non-optimal images.

File size is certainly a factor but there are other considerations at play as well when choosing an image format.