JPEG images are tagged using something called and EXIF tag (EXtra InFormation). Most digital cameras automatically store information in this EXIF tag for all of the pictures that you take. They store things like time, position, landscape or portrait depending on your model of camera, but this isn't really the information that's most helpful to you. You really want things like a description and maybe a list of people or things in the picture or just some keywords.

To tag our JPEG images, we'll use some programs named rdjpgcom and wrjpgcom (Read JPG comment and Write JPG comment). In my distro (Debian) they are included in a package named (libjpeg-progs).. they should be provided in your distro by the same or similar name.

To get started with rdjpgcom we'll execute the command

rdjpgcom tux.jpg
on the tux.jpg file I've provided. Our output should be a blank line because there is no EXIF information in this picture. Next, we execute the following command
wrjpgcom -comment "Tux the Penguin - The Linux Mascot" tux.jpg > new.jpg
Now this one is kinda funny because it won't change the file in-place, so we have to direct it to another file "new.jpg". If you are going to use this in a script, you'd need to create a temporary file to accomplish this, but we'll get to that later. For now, we just realize that our "new.jpg" is a copy of the original with the EXIF tag added. To see our comments, we run the previous command with the new filename like so
rdjpgcom new.jpg
and our output looks like this
Tux the Penguin - The Linux Mascot

Now, if we have some image library application or a desktop search tool like we mentioned before, we could search for all images dealing with "linux" or "penguins" or "mascots" and this image would be part of our results. This is much better than organizing your images into folders and having to scan through them with some thumbnail viewer looking for the right one.