Choose Currency:

Using Image Keywords in Image Filenames and File Paths

Although the names that you give your images and the location that you store them on your website are largely invisible to the average user, you should not think that this information goes un-noticed by all. Most importantly, the Search Engines, which as we have already established are unable to identify, interpret, or understand images themselves, rely on every little pointer that they can find to correctly understand what your images might be about, and how they relate to the text that surrounds them. Your webpage title, description, header tags and page content will do the major job of indicating to the Search Engine what your page and images portray, but additional clues from the filename that you give to an image, and the folder names that are used to store it in, will all reinforce the confidence that the Search Engine has in the content of your image and its relevance to a search result. Sometimes, if a webpage has no accompanying text at all, the filename is the only thing that a Search Engine has to indicate what the image is about. Google recommends that each image filename is a "good description of the subject matter of the image". Forget the standard 'IMG00023.JPG' that the image came with when you downloaded it from your camera. It makes a lot of sense, if you value your Search Engine rankings, to give the image a proper, human-readable name that correctly describes its content, and store it in folders that form a logical path to where you might expect to find it: 'images\europe\england\london\tower-bridge-at-sunset.jpg'.

If your website is translated into multiple languages, then your image filenames could be too, though this might require images to be duplicated, unless a dynamic image-naming system is used. Duplicate images are not such a problem these days, though, with webhosts frequently offering unlimited storage, so this approach is certainly worth considering.

Image Filename Formats

There are very few rules here, but in order to keep everything compatible with everything else, I'd recommend that you adopt the following suggestions when renaming your image files and their containing folders:

Bulk Image Renaming from a CSV File

Lets imagine that you have a folder of 1000 images named 'DSC0001.jpg - DCS1000.jpg' that you wish to use on your website. You realise that its a good idea to rename them for SEO reasons. You don't want to rename your master file of full sized images, of course: that would make a real mess of your home computer's file structures, so you decide to only rename the images that are going online, to be showcased on your website. Renaming 1000 images is going to take a long time to do by hand, though, and how do we keep track of the 'before' and 'after' names? Luckily, this can all be accomplished quite easily with a CSV file (stands for Comma Separated Values) to hold the 'before' and 'after' names, and a Windows Batch file to do the processing. A Batch file is one of the earliest types of programs from the days of DOS, but even in Windows 10 they are still supported and valuable. All we need to create a CSV file and a Windows Batch file is a simple text-editor program, such as 'Notepad', which you can find by clicking 'Start > All Apps > Windows > Accessories > Notepad'. Don't use a word-processor program, as it will cause errors.

First, we create a CSV file containing a list of all the image names. We want to rename an image called 'DSC0001.jpg' to it's new name of 'white.jpg', and so on. Each line lists the current name of an image, then a comma that separates the names, then the wanted name of that image.


Note that we don't need to add the 'jpg' file suffix for either the 'before' or 'after' names in the list. Save the file as 'images.txt' in a folder that contains the images to be renamed. Next, we create a Windows Batch file containing the commands that do the re-naming. Click 'File > New' to start a new file in Notepad, and type in the following lines:

@echo off
for /F "tokens=1,2 delims=," %%j in (images.txt) do (
rename "%%j.jpg" %%k.jpg

Save that file as 'rename.bat' in the same folder as before. Note that Notepad normally names all its files with the '.txt' suffix, so you will need to click the 'Save as type' dropdown box below the 'File name' during the save-dialog, and change the default 'Text Documents (*.txt)' value to 'All Files (*.*)' before clicking the 'Save' button. Now, all you have to do is to use 'My Computer' or 'File Explorer' or 'Windows Explorer' to browse to the folder in question, then double-click on the 'rename.bat' program. Hey presto: all the files listed are renamed as expected. Any files within the folder that are not mentioned in the list will be ignored. You can import the CSV file to an online database for speedy lookups of the before and after filenames, so existing databases don't need to be changed.

A pre-prepared set of these files, along with some sample images to rename, is available as a free download. In addition, there is another Windows Batch file included named 'revert.bat' which will return the images to their original names.

Other uses for your keywords

Web design and photography by   ::   All images and pages on this site are © 2005 - 2018   ::   All rights reserved
Flag Counter