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?
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.
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.
精彩评论