Resize tall images vertically first

This commit is contained in:
Andrew Murray 2026-04-01 10:00:39 +11:00
parent ec8272044d
commit 4ef0ac611d

View File

@ -2428,7 +2428,14 @@ class Image:
(box[3] - reduce_box[1]) / factor_y,
)
return self._new(self.im.resize(size, resample, box))
if self.size[1] > self.size[0] * 100 and size[1] < self.size[1]:
im = self.im.resize(
(self.size[0], size[1]), resample, (0, box[1], self.size[0], box[3])
)
im = im.resize(size, resample, (box[0], 0, box[2], size[1]))
else:
im = self.im.resize(size, resample, box)
return self._new(im)
def reduce(
self,