mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
improve resolution handling (#396)
* improve resolution handling * improve resolution handling * improve resolution handling * improve resolution handling
This commit is contained in:
@@ -6,6 +6,25 @@ import os
|
||||
from PIL import Image
|
||||
|
||||
|
||||
def image_is_generated_in_current_ui(image, ui_width, ui_height):
|
||||
H, W, C = image.shape
|
||||
|
||||
if H < ui_height:
|
||||
return False
|
||||
|
||||
if W < ui_width:
|
||||
return False
|
||||
|
||||
k1 = float(H) / float(W)
|
||||
k2 = float(ui_height) / float(ui_width)
|
||||
d = abs(k1 - k2)
|
||||
|
||||
if d > 0.01:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user