Skip to content

Commit

Permalink
fix crop in Cond2ImPipe
Browse files Browse the repository at this point in the history
  • Loading branch information
noskill committed Jan 15, 2025
1 parent c6580b1 commit 0565eb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion multigen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .pipes import Prompt2ImPipe, Im2ImPipe, MaskedIm2ImPipe, CIm2ImPipe
from .pipes import Prompt2ImPipe, Im2ImPipe, MaskedIm2ImPipe, CIm2ImPipe, Cond2ImPipe
from .sessions import GenSession
from .prompting import Cfgen
from .loader import Loader
Expand Down
4 changes: 3 additions & 1 deletion multigen/pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ def setup(self, fimage, width=None, height=None,
self.fname = fimage
image = Image.open(fimage).convert("RGB") if image is None else image
self._original_size = image.size
self._use_input_size = width is None or height is None
image = util.pad_image_to_multiple_of_8(image)
self._condition_image = [image]
self._input_image = [image]
Expand Down Expand Up @@ -914,7 +915,8 @@ def gen(self, inputs):
inputs.update({"image": self._input_image,
"control_image": self._condition_image})
image = self.pipe(**inputs).images[0]
result = image.crop((0, 0, self._original_size[0], self._original_size[1]))
result = image.crop((0, 0, self._original_size[0] if self._use_input_size else inputs.get('height'),
self._original_size[1] if self._use_input_size else inputs.get('width') ))
return result


Expand Down

0 comments on commit 0565eb0

Please sign in to comment.