You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a file needing a orientation change is made into a thumbnail, the aspect ratio is not inverted during the -scale operation. Leading to a distorsion in the result.
Scenario
source image (orientation 6, size 1800x1200). 1200 being the height of the not re-oriented source image and the width of the intermediate (1200x1800) re-oriented image:
get_thumbnail(source_img, 600). Which should result, taking the orientation into account, to a 600x900 full geometry
the convert command is actually called with convert sourcefile -auto-orient -colorspace RGB -scale 600x400! -interlace line -quality 95 thumbfile
leading to the final image :
Additional note
the dimensions seem to be reversed during a set_size but not at scale operation time
@unittest.skipIf('pil_engine'notinsettings.THUMBNAIL_ENGINE, 'the other engines fail this test')
deftest_image_with_orientation(self):
name='data/aspect_test.jpg'
item, _=Item.objects.get_or_create(image=name)
im=ImageFile(item.image)
th=self.BACKEND.get_thumbnail(im, '50x50')
# this is a 100x200 image with orientation 6 (90 degrees CW rotate)
# the thumbnail should end up 25x50
self.assertEqual(th.x, 25)
self.assertEqual(th.y, 50)
Just saw a test with the exact same issue. It has been skipped with the reason "the other engines fail this test" and fixed for the pillow engine in #455.
challet
changed the title
Inverted ratio thumbnail with source orientation, ImageMagick (convert) engine
Inverted thumbnail ratio with orientation in source, ImageMagick (convert) engine
Jan 30, 2020
Hello,
When a file needing a orientation change is made into a thumbnail, the aspect ratio is not inverted during the
-scale
operation. Leading to a distorsion in the result.Scenario
6
, size1800x1200
). 1200 being the height of the not re-oriented source image and the width of the intermediate (1200x1800
) re-oriented image:get_thumbnail(source_img, 600)
. Which should result, taking the orientation into account, to a600x900
full geometryconvert sourcefile -auto-orient -colorspace RGB -scale 600x400! -interlace line -quality 95 thumbfile
Additional note
sorl-thumbnail/sorl/thumbnail/images.py
Lines 139 to 145 in 571388b
sorl-thumbnail/sorl/thumbnail/engines/base.py
Lines 49 to 54 in 571388b
The text was updated successfully, but these errors were encountered: