Monday, May 25, 2009

More on transparency and indexed color

Welcome back. I had a follow-up question on transparency which asked a question about this:


Particularly, the question came up that the reader couldn't get the check box to remove unused colors to be active so he could check it and save his image as transparent. In case you don't understand, here's what I mean:


That part that's lit up in that picture. The truth is that you don't need it checked -- if you put your image on a transparent work space, change the mode to "indexed", when you save it as a ".gif" file it should leave the transparent parts transparent whether you remove the unused colors or not.

But the truth is this: if you remove unused colors, the file will save to a smaller size, and while in this world of DSL, 3G and high-speed cable you prolly don't care about file size, you can be a good neighbor and reduce your file sizes for the sake of merely improving the net load time of your images.

To get that box checked, do this:


You can check any of the color-indexing options, and the check box will magically become an active check box. And you can leave it checked in case you think you're missing something when you tell GiMP to reduce the colors for you.

One last note: without getting mired into Geek Speak, when you reduce colors you will have the best results when you reduce to these numbers of colors:

16
32
64
128

These are the natural breaks in color resolution which your computer still understands even though for the most part you all have something like 65,000+ color HD-resolution monitors. This is what will get you the best file size reductions because of the way .gif format helps your computer and your software think about color.

Thursday, May 14, 2009

Other GIMP tutors

Just got this link for GiMP tutorials in French.

Thought I'd share.

Sunday, April 12, 2009

Transparent Background Revisited

Yes: WOW. This is such a simple tutorial, but it's probably one which many of you have considered and (maybe) not quite gotten away with. Avid reader "D" has a Visio document which he saved in .bmp format, and now he wants to open it in GiMP and take the diagram out of the source file and create a new file in which the background is transparent.

Excellent.

I've created a source file for us to use, thus:


This is a fairly-rudimentary example of what "D" is thinking about, but it's a size we can work with and see what's about to happen to our image.

Now, this image is 488x488, so our first step is to create a target image of the same dimensions with a transparent background, thus:


Now go back to our source image and select the white background using the "magic wand" tool. After the white is selected, go under the "Select" menu and choose "Invert" and then "Grow...", telling GiMP to grow your selection by 1 pixel.


What you have now is a selection of your image which is mostly protected from the jaggies -- the rough pixels which will make your final use of the image mostly perfect. I say "mostly" perfect for a reason we will discuss in a minute.

Copy that selection and go back to your transparent target image.

Now, when you "paste" what you have copied from your source image into the target, your "Layers" dialog is going to look something like this:


Right? The pasted stuff is in a "Floating Selection (pasted layer)", which is deceiving -- because it needs to be anchored to the transparent layer so we can go on.

Just click the little anchor button in the "Layers" dialog, and let's move on.

Now, the last step here is critical -- because the n00b will think, "well, just save as a .gif now, and I'm golden.

NO. You are NOT golden. See: a .gif file requires the image to be in INDEXED color mode to save exactly as you see it, so first you have to go into the "Image" menu, and under "Mode" select "Indexed".

This will produce this dialog, for which you should make the options look exactly like this:


And this really will have two effects on this image. The first is one you may or may not care about, but by reducing the color pallet to 16 colors, you will make the file significantly smaller. But the second is the real money-maker: this allows the GiMP to save the image as a transparency when you save.

Now, before we save, let's look at this image one last time. I know all of you by now have noticed the white border around the image. This isn't really all white: it is the field in this image where all jaggies get buffered to some intermediate color so when you lay it over some other image, the original image on transparency doesn;t have all manner of jagged edges. It simply has a one-pixel wide white boundary which, in most circumstances, is totally agreeable to the eyes. And this is especially useful when your source image isn't as high-res as this one is: it protects the original image from completely disintegrating when you paste it over something else.

So now we're going to save the target image thus, using "Save as ...":


And when the "GIF" dialog comes up, just click "Save". And what you should get in the end is this:

And the chopped-off parts here are Blogger's fault. But notice that my image shows the gray of the background through without making you crazy from looking at jaggedy edges.

Makes sense? I knew it would.