jezs00 / pycasso

A system to send AI generated art to an E-Paper display through a Raspberry PI unit
MIT License
70 stars 4 forks source link

Stable Diffusion Image Size #32

Closed jezs00 closed 1 year ago

jezs00 commented 1 year ago

Check Stable diffusion works without resize and crops instead. Try to recreate https://github.com/jezs00/pycasso/issues/26#issuecomment-1399090090 .

recrudesce commented 1 year ago

Could you not just ask SD to generate the image based on the known epd screen size ?

jezs00 commented 1 year ago

Yep that's what it's supposed to do. It accepts only multiples of 64 so normal process is request an image slightly too big and then crop it. My assumption is it's resizing somewhere instead of cropping.

On Sat, 21 Jan 2023, 11:13 am recrudesce, @.***> wrote:

Could you not just ask SD to generate the image based on the known epd screen size ?

— Reply to this email directly, view it on GitHub https://github.com/jezs00/pycasso/issues/32#issuecomment-1399092682, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUTEK7DDDEVQZNBHCT63BQLWTMSYXANCNFSM6AAAAAAUCCFLLU . You are receiving this because you authored the thread.Message ID: @.***>

jezs00 commented 1 year ago

Issue is based on resize_image() in provider.py. This will resize the image to capture as much as possible of it on the screen, which works depending on the display, however if the factor of resize required for the short edge of the screen is smaller than the factor of resize required on the long edge, it will display black bars. Writing replacement function fit_image() to thumbnail on a factor, instead of just on longest edge.

jezs00 commented 1 year ago

Should be fixed. Just testing on pi, then I'll bundle it into a release.

jezs00 commented 1 year ago

Appears to work. Closing for now and releasing new version.