Skip to content

Instantly share code, notes, and snippets.

@aviramsegal
Created January 14, 2013 08:35
Show Gist options
  • Save aviramsegal/4528623 to your computer and use it in GitHub Desktop.
Save aviramsegal/4528623 to your computer and use it in GitHub Desktop.
Gimp Python-Fu Script for setting DPI for PNG Images
import os, glob
import string
from gimpfu import *
mime_type = 'png';
path = '/home/avirams/Dropbox/articles/WebSphere Scheduler/images'
# here we do a foreach loop
for infile in glob.glob( os.path.join(path, '*.' + mime_type) ):
image = pdb.gimp_file_load(infile, '1')
pdb.gimp_image_set_resolution(image, 116, 120)
temp_list = infile.split('/')
filename = temp_list.pop()
new_path = '//home/avirams/Dropbox/articles/WebSphere Scheduler/images116120/' + filename
pdb.gimp_file_save(image, drawable, new_path, 'Saved image')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment