Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Most smallest lossless image format and/or library?

I was having image size problem with my iOS app, and I discovered this article while finding some image size optimization solution

After reading it, I realized I don't need to use only PNG or JPEG. Actually, I can use any image format which is not supported on iOS platform by default. Because if I can get actual pixels, converting it to UIImage via CGImage is just a simple work. I can use special bitmap format and special decoder. For an example, there's a technique called texture atlas which stores many images within a big bitmap, and it can save extra duplicated buckets.

So I'm asking about most smallest (when compressed) lossless image compression format and/or library. If you know some great format or library, I wish you to recommend it to me.

It would be nice if it's open-source, but I don't mind if it's proprietary closed-source, and paid solution. What I need is only awesome image compression, not source code. Of course, it must be usable on iOS platform, so it should offer decoder usable in C, C+ or Objective-C language. (I don't need encoder in these platform)

like image 207
eonil Avatar asked Mar 23 '12 01:03

eonil


2 Answers

If you want to optimise JPEG, I'd go for http://jpegmini.com

If you want to step out of JPEG and PNG you could try Google's WebP (http://code.google.com/speed/webp/) but I have no idea if there are any iOS libraries for it and if they are whether they are any good.

like image 180
Andy Davies Avatar answered Nov 16 '22 19:11

Andy Davies


Different images have different compressions. With JPEG you sacrifice quality for smaller size and with PNG 24 you get alpha transparency. What you're probably more interested in is getting the smallest size image possible for the format you're using. There are 2 good command line tools for handling this. You kind of have to play around with different types, programs like photoshop make it really easy to see which is smallest. Once you've found your optimum format you can use a "smusher" to remove extraneous data that isn't needed by the image but often gets added by the editor. Below are 2 command line utilities I uses to make sure my images are as small s possible when building websites, but are also beneficial for any application.

optipng: http://optipng.sourceforge.net/ jpegoptim: https://github.com/glennr/jpegoptim#readme

both can be installed easily using homebrew: Link and I'd assume theres an option for macports as well.

There also C-based so either can be used in an iOS project.

like image 33
Chris Avatar answered Nov 16 '22 19:11

Chris