This python script helps optimize images for search engines by renaming all images in a given directory.
Created by Starmorph Web Design
- Renames all images in a given directory with a specified new filename and a counter.
- Generate alt text with AI.
- Image compression
- Image filetype conversion
To use the script, call the rename_images
function with the following arguments:
rename_images(directory, new_filename, alt_keyword)
directory
is the path to the directory containing the images to be renamed and optimized.
new_filename
is the new base filename to be used for the images. The counter will be appended to the end of the filename for each image.
For example, the following call will rename and optimize the images in the current directory:
rename_images('./', '3d-abstract-book')
The script currently supports .jpg, .png, and .webp image formats.
The script requires the following libraries: os PIL (Python Imaging Library)