-> Demo Site <-
When training Stable Diffusion (or other generative image models) we need high quality and cropped training images at 512x512. Birme is the best tool for doing this quickly, and with the help of smartcrop.js it's truly a powerful tool for batch cropping images.
Clone the repository and open index.html in your favorite browser (excluding Firefox). Feel free to bookmark!
git clone https://github.com/livelifebythecode/birme-sd-variant.git
cd birme-sd-variant
python -m webbrowser index.html # or simply open the index.html file
git clone https://github.com/livelifebythecode/birme-sd-variant.git
cd birme-sd-variant
docker-compose up -d
# Open browser to => http://<HOST_IP>:8080
Birme restricts the users ability to choose what smoothing is applied which can result in a lower quality cropped image.
In the Birme code, notice the line con.imageSmoothingQuality = "medium";
hardcodes the smoothing quality when we crop the image.
process_image(img, file) {
...
let canvas = document.createElement("canvas");
canvas.width = tw;
canvas.height = th;
let con = canvas.getContext("2d");
con.imageSmoothingEnabled = true;
con.imageSmoothingQuality = "medium";
...
}
(sourced on 10-14-22: line #627)
Select the desired smoothing quality in the "Image Format / Quality" settings
TODO: Show comparison of 'Medium', 'High', and 'Hermite' quality presets High works better on landscape/subjects typically, where as Medium is better at smoothing close up text.
- ๐ฆ FIREFOX NOT SUPPORTED - supported browsers
- Birme Author, support them
- Small feature written by me
The Hermite quality option uses the Hermite resize library so you can experiment with what gives you the best quality image for your source images.