Skip to content

Instantly share code, notes, and snippets.

@nunenuh
Created June 3, 2018 16:19
Show Gist options
  • Save nunenuh/780dbd9c5304475812c7b0b1f379b791 to your computer and use it in GitHub Desktop.
Save nunenuh/780dbd9c5304475812c7b0b1f379b791 to your computer and use it in GitHub Desktop.
Mogrify Rescale with python automate
import os
base_path = '/home/nunenuh/Desktop/skripsi/dataset/testing'
def rescale(base_path,percent):
dirz = os.listdir(base_path)
my_list = []
for dr in dirz:
path = os.path.join(base_path, dr,'*.jpg')
my_list.append(path)
for pt in my_list:
str_scr = 'mogrify -scale '+str(percent)+'% "'+pt+'"'
os.system(str_scr)
rescale(base_path, 12.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment