Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is JPG really only acceptable for use in Android?

Android supports three image formats with this rating:

PNG (preferred), JPG (acceptable) and GIF (discouraged). Source: http://developer.android.com/guide/topics/resources/drawable-resource.html#Bitmap

Why is JPG only listed as acceptable? Isn't JPG a better format for images without transparency because they take less space than PNG:s?

Or does PNG behave so much better during runtime that it is worth storing full screen background images etc. as PNG:s even if they tend to make the APK much bigger?

I'm not very satisfied with many apps containing a lot of graphics eating the space on my Internal storage so it's getting full all the time. And my guess is that they are badly optimized in that sense by using PNG when they could use JPG because the developer guide says PNG is preferred without explaining why. Can anyone tell if I'm correct when saying JPG should be used for non-transparent images?

like image 247
likebobby Avatar asked Mar 11 '11 15:03

likebobby


People also ask

Can I use JPG in android?

About image formats. Android apps typically use images that are in one or more of the following file formats: AVIF, PNG, JPG, and WebP.

What Image format is best for android?

In android the best format of Image is PNG as it light compare to JPG,JPEG etc.So its easy to draw and take less time to perform the operation while using these images.

What is JPG format in android?

JPG format is a lossy compressed file format. This makes it useful for storing photographs at a smaller size than a BMP. JPG is a common choice for use on the Web because it is compressed.

Why do people use JPG instead of PNG?

Because of their different compression processes, JPEGs contain less data than PNGs — and therefore, are usually smaller in size. Unlike JPEGs, PNGs support transparent backgrounds, making them preferred for graphic design.


2 Answers

This article

http://mobile.tutsplus.com/tutorials/mobile-design-tutorials/mobile-design_png-or-jpg/

is more focused on iOS development, but it seems to agree with what you suspected about JPGs being fine for non-transparent images. PNGs are lossless, so they have that advantage, which is probably why they are recommended, but if you can live with some loss in exchange for size optimization, then JPGs seem fine to me.

like image 61
Keysmack Avatar answered Oct 20 '22 21:10

Keysmack


PNGs are lossless while JPEGs are lossy. I would expect PNGs to scale slightly better, but if you can live with the JPEG quality it seems appropriate/acceptable.

like image 39
djg Avatar answered Oct 20 '22 21:10

djg