Thursday, March 27, 2008

ITT: We learn about image formats

Ever wonder what you should save an image as? Well now you have a handy guide!

So first, the difference between lossy and lossless formats. Lossy means that in all subsequent modifications of the image, data is lost making for progressively worse quality. So if you save a JPEG three times, it will degrade in quality every time. Lossless just means that in subsequent saves, there is no loss in quality, it does not mean there's no loss in quality from the source image. GIF is considered lossless because whether you save once or fifty times, the image looks the same. However, if you've ever tried to save a photo as a GIF, you know it looks like crap. This is because GIF only supports 256 colours and will force the document into those colours. Of course, no format can support infinite colours so all formats will force colour if needed. That means that not all lossless formats are going to give you the same result.

Secondly, if you're saving a vector, you're going to be saving it as SVG. End of story.

So, the leaves the raster formats:

GIF - 256 colours, compression, lossless, supports animation. If you're using black and white, there's no reason not to use it. If your image is animated, there's no other format as supported. With other images it becomes quite iffy, I'm actually inclined to say a dithered photograph actually looks better than a image with a smaller pallet, but with unsupported colours. Either way, I'd rather use something else, but bear in mind GIF files usually have the smallest size as a combination of their compression and limited colour data.

PNG- Up to 24 bit colour, compression, lossless. It's viewed as a successor to GIF since GIF makes things look so crappy. I like to use it with most things that have a limited pallet. If you're saving something like a photograph, the PNG file would be several times bigger than the JPEG counterpart and not noticeably better (assuming you're saving at a high quality, i.e. not with MS Paint). If I do something in Paint, I'm most inclined to save it as a PNG because GIF looks like crap and it saves JPEG at pretty low quality. Greyscale I think would be better served under JPEG, but I tend to save those as PNG too, because I'm not keen on losing my data.

JPEG- Up to 24 bit colour, compression, lossy. What can I say, it's JPEG. If you have a large colour pallet, that's going to beastly huge under most lossless formats. It has an efficient compression process and if you save it right it will look just fine. Try not to further edit JPEGs though (obviously it's unavoidable, but prevent it where you can), because the loss is going to be noticeable after a few generations.

BMP- Up to 64 bit colour (you just can't do it with Paint), no compression, lossless. That's a huge colour range. That's also going to be a huge file size. You can still compress the file by zipping it though. The nice thing about BMP is that you know it will be compatible with everything. If you need to make sure something is compatible and bandwidth is not going to be a problem, then go for it. That said, if you go and upload some 3000px x 2000px BMP and then post it on a forum, you're an idiot.

TIFF- Up to 48 bit colour, compression, lossless or lossy, very versatile. The inter-application format of choice for professionals in the graphics business. There's a large colour pallet, which is nice, but more importantly is its versatility. For instance, you can define layers in a TIFF document, so you can move something from Painter into Photoshop without skipping a beat. The problem is that often something is marked in a TIFF document that is unrecognizable by a program. Compatibility with TIFF is kind of a developer's nightmare.

RAW- Compression, lossless. This is for photographers mostly, it gives you the raw data captured by the camera's sensors. That means there's a huge variation in RAW files between different cameras. It might not seem like a huge difference from a JPEG copy, but it gives you more control for processing later. Usually I'd just make JPEG copies though, I'm not that hardcore about my photos.

Now you know how to save your images! That gives you a step up over half the internet. Spread the word and maybe one day I can dream of reading my webcomics without JPEG artifacts.

Bonus section: How to waste ink like a pro!

Just making a black square is so passé, what you should do is go into Photoshop (version doesn't matter as long as it's not a consumer level product), start a new document in CMYK mode, make sure you're using rich black, fill the entire document. Then go into Image > Adjustments > Channel Mixer and max out the outputs of all the channels. The result should be a stunningly black document, either that or a really damp piece of paper.

No comments: