jmunsch

convert images linux / python

Aug 20th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. # python linux create sepia / high contrast / black&white images
  2. # from current images in directory
  3.  
  4. import os
  5. ds = ['hi-con','sepia','bw']
  6. for d in ds:
  7. try:
  8. os.mkdir(d)
  9. except:
  10. pass
  11. for img in os.listdir("."):
  12. if ".jpg" in img.lower():
  13. print('Converting',img)
  14. hc_img = img
  15. sep_img = img
  16. gray_img = img
  17.  
  18. os.system("convert -level 07%,87% "+hc_img+" ./hi-con/hi-cont-"+img)
  19. os.system("convert -sepia-tone 92% "+sep_img+" ./sepia/sepia-"+img)
  20. os.system("convert -colorspace Gray "+gray_img+" ./bw/Gray-Scale-"+img)
  21. else:
  22. print(img)
  23. print('?????')
Advertisement
Add Comment
Please, Sign In to add comment