Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which image file format loads the fastest

Tags:

android

iphone

I am looking at image file formats and I would like to know which one of png, gif, jpeg, bmp, and tiff is the most efficient in terms of loading and displaying the image data. I don't care so much about the file size on disk, just the amount of CPU needed to display the images on an embedded device like Android, iPhone, or a Windows Phone.

like image 330
Don Sampson Avatar asked May 22 '11 01:05

Don Sampson


3 Answers

I imagine an uncompressed format would be the most efficient from a processing perspective, since you don't need any processing to decompress it. But you pay the cost of having a larger file size. BMP and TIFFs are the two uncompressed formats in the list of choices you gave.

like image 131
Ken Pespisa Avatar answered Oct 29 '22 19:10

Ken Pespisa


For Android, the two preferred formats are very much JPEG and PNG. Use the former when lossy compression is okay (such as for pictures), the latter when you need the exact pixels to remain untouched (such as for UI graphical elements). GIF images are somewhat supported for loading, but should never be used for normal application resources. TIFF and BMP even more so.

like image 37
hackbod Avatar answered Oct 29 '22 20:10

hackbod


I have a little experience with this from doing streaming webcam stuff. Unfortunately, my constraint was on the compression side. I found JPEG was surprisingly fast, PNG was only competitive when I reduced the compression level (to the minimum level actually), and then had to deal with the larger data size. Your version of the problem is on the decoding side, but also you may have to investigate the tradeoff between CPU vs. bandwidth on your own platform.

My point here though is that both JPEG and PNG have compression levels, and in particular for PNG, the compression level strongly affects the compression CPU usage, although it may have a lesser effect on decoding time. So it's not just a matter of format, but also the compression settings used for each format.

like image 35
Ethan Avatar answered Oct 29 '22 20:10

Ethan