Skip to content

Simple Python Script to scale all images of a folder to a square in a specific resolution useful for ex. in SD Lora Training.

License

Notifications You must be signed in to change notification settings

zeittresor/cutscale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

cutscale (Python Script to scale Images in a batch to squares)

Script to Scale (up / down all Images of a folder to a square with a given Resolution ex. "python cutscale.py 768" will scale up/down every image using LANCZOS algorithm (using the pillow library) to a square of 768x768 (out of the middle of the image from the shortest side while cutting off the left/right or top/down parts not required to get the square).

Usage: python cutscale.py 1152 -> Result: Every image of the folder where you execute the script will be scaled to new files with a resolution of 1152 x 1152 with the name 1152_[filename].[png/jpg/jpeg]. The orig. Image will stay untouched.

The Script should work with any resolution to get squares. (Might be useful for ex. using Kohya_ss / Dreambooth lora or embeddings training in Stable Diffusion).

Source: https://github.com/zeittresor/cutscale

About

Simple Python Script to scale all images of a folder to a square in a specific resolution useful for ex. in SD Lora Training.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages