mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
autorotate init images using exif orientation tag
This commit is contained in:
parent
45cc867b0c
commit
b296933ba0
@ -849,6 +849,7 @@ class Generate:
|
|||||||
print(
|
print(
|
||||||
f'>> loaded input image of size {image.width}x{image.height}'
|
f'>> loaded input image of size {image.width}x{image.height}'
|
||||||
)
|
)
|
||||||
|
image = ImageOps.exif_transpose(image)
|
||||||
return image
|
return image
|
||||||
|
|
||||||
def _create_init_image(self, image, width, height, fit=True):
|
def _create_init_image(self, image, width, height, fit=True):
|
||||||
@ -857,7 +858,6 @@ class Generate:
|
|||||||
image = self._fit_image(image, (width, height))
|
image = self._fit_image(image, (width, height))
|
||||||
else:
|
else:
|
||||||
image = self._squeeze_image(image)
|
image = self._squeeze_image(image)
|
||||||
|
|
||||||
image = np.array(image).astype(np.float32) / 255.0
|
image = np.array(image).astype(np.float32) / 255.0
|
||||||
image = image[None].transpose(0, 3, 1, 2)
|
image = image[None].transpose(0, 3, 1, 2)
|
||||||
image = torch.from_numpy(image)
|
image = torch.from_numpy(image)
|
||||||
@ -874,7 +874,6 @@ class Generate:
|
|||||||
image = self._fit_image(image, (width, height))
|
image = self._fit_image(image, (width, height))
|
||||||
else:
|
else:
|
||||||
image = self._squeeze_image(image)
|
image = self._squeeze_image(image)
|
||||||
|
|
||||||
image = image.resize((image.width//downsampling, image.height //
|
image = image.resize((image.width//downsampling, image.height //
|
||||||
downsampling), resample=Image.Resampling.NEAREST)
|
downsampling), resample=Image.Resampling.NEAREST)
|
||||||
image = np.array(image)
|
image = np.array(image)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user