-
-
Save weshouman/c8c7950a94051aa2407d2a9888b61007 to your computer and use it in GitHub Desktop.
A simple script to automatically downsize all the images in a folder using Gimp python console (Gimp->Filters/Python-Fu/console).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import listdir | |
from os.path import isfile, join | |
## Set image folder path | |
dir_path = "C:/img_dir/" | |
## Store files names in folder | |
files = [f for f in listdir(dir_path) if isfile(join(dir_path, f))] | |
for file in files: | |
image = pdb.file_jpeg_load(dir_path+file, dir_path+file) | |
## Don't forget to create the 'small/' folder in your image directory | |
save_path = dir_path+"small/"+ file | |
## save image with 85% of original quality | |
pdb.file_jpeg_save(image, image.active_drawable, save_path, save_path, 0.85, 0, 0, 0, "", 0, 0, 0, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment