Page MenuHomePhabricator

Different height of thumbnail
Open, MediumPublicBUG REPORT

Description

What is the problem?

For some images, the height of the thumbnail generated by my local thumbor-plugins is different to that generated by beta.

For example:

Reproduction

My configuration (thumbor.conf) is: P34931

I generate the thumbnail on my local system by going to the url: http://localhost:8800/thumbor/unsafe/<width>x/<url>.

I have reproduced it with thumbor running in docker on Buster:

$ blubber .pipeline/blubber.yaml dev > Dockerfile
$ make build

I have also reproduced this when I installed locally via python on Bullseye:

python3 -m pip install -r requirements.txt
Images to reproduce problem
Environment

Operating system: Debian Buster and Bullseye
thumbor-plugins: commit 92eafe2477fdd122244b572e1a0f57652bdbc8f8

Event Timeline

I have found some examples where the width is different between beta and local. However, in those cases it is local which appears to be rendering the correct width.

For example, this file in 320px on beta gets rendered at 319px width (see) but locally gets rendered at 320px width.

Do you have debug logs to confirm what imagemagick command gets run?

Do you have debug logs to confirm what imagemagick command gets run?

So I ran thumbor with: thumbor -d -l debug --port 8800 --conf=thumbor_beta.conf -a wikimedia_thumbor.app.App and generated the CuteGoat.jpg at 320px. Output in the terminal:

2022-11-02 09:27:39 thumbor:DEBUG Installing manhole
Manhole[33025:1667381259.0869]: Not patching os.fork and os.forkpty. Using user socket path /tmp/manhole-8800
Manhole[33025:1667381259.0873]: Manhole UDS path: /tmp/manhole-8800
Manhole[33025:1667381259.0873]: Waiting for new connection (in pid:33025) ...
2022-11-02 09:27:39 thumbor:DEBUG Loading extension wikimedia_thumbor.handler.images
2022-11-02 09:27:39 thumbor:DEBUG Loading extension wikimedia_thumbor.handler.core
2022-11-02 09:27:39 thumbor:DEBUG Loading extension wikimedia_thumbor.handler.healthcheck
2022-11-02 09:27:39 thumbor:DEBUG Monkey patching ContextHandler.initialize
2022-11-02 09:27:39 asyncio:DEBUG Using selector: EpollSelector
2022-11-02 09:27:39 root:DEBUG thumbor starting at 0.0.0.0:8800
2022-11-02 09:28:01 thumbor:DEBUG [Proxy] load: '.jpg'
2022-11-02 09:28:01 thumbor:DEBUG [Proxy] Looking for a jpg engine
2022-11-02 09:28:01 thumbor:DEBUG [IM] Dumping buffer into temp file
2022-11-02 09:28:01 thumbor:DEBUG [ExiftoolRunner] command: ['/usr/bin/exiftool', '-s', '-s', '-ImageSize', '-ProfileDescription', '-ColorType', '-FileType', '-Transparency', '-Artist', '-Copyright', '-ImageDescription', '-m', '-q', '-q', '/tmp/tmprke8adzw']
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/exiftool', '-s', '-s', '-ImageSize', '-ProfileDescription', '-ColorType', '-FileType', '-Transparency', '-Artist', '-Copyright', '-ImageDescription', '-m', '-q', '-q', '/tmp/tmprke8adzw']
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Stdout: b'ImageSize: 1920x1347\nFileType: JPEG\n'
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Stderr: b''
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Return code: 0
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Duration: 131.05
2022-11-02 09:28:01 thumbor:DEBUG [IM] EXIF: {'ImageSize': '1920x1347', 'FileType': 'JPEG'}
2022-11-02 09:28:01 thumbor:DEBUG [IM] File has no ICC profile
2022-11-02 09:28:01 thumbor:DEBUG [IM] reorientate
2022-11-02 09:28:01 thumbor:DEBUG [IM] resize: 320.0 224.0
2022-11-02 09:28:01 thumbor:DEBUG [IM] jpeg:size hint: '640x449'
2022-11-02 09:28:01 thumbor:DEBUG [IM] Queued operators: ['-define', 'jpeg:size=640x449', '-resize', '320x224^', '-gravity', 'center', '-extent', '320x224']
2022-11-02 09:28:01 thumbor:DEBUG No image format specified. Retrieving from the image extension: .jpg.
2022-11-02 09:28:01 thumbor:DEBUG Content Type of image/jpeg detected.
2022-11-02 09:28:01 thumbor:DEBUG [IM] read: .jpg 87
2022-11-02 09:28:01 thumbor:DEBUG [IM] Chroma subsampling: '4:2:0'
2022-11-02 09:28:01 thumbor:DEBUG [IM] Generating image with quality 87
2022-11-02 09:28:01 thumbor:DEBUG [IM] Queued operators: ['-define', 'jpeg:size=640x449', '-resize', '320x224^', '-gravity', 'center', '-extent', '320x224', '-quality', '87', '-sampling-factor', '4:2:0']
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/convert', '-define', 'tiff:exif-properties=no', '-define', 'jpeg:size=640x449', '-resize', '320x224^', '-gravity', 'center', '-extent', '320x224', '-quality', '87', '-sampling-factor', '4:2:0', '/tmp/tmprke8adzw[0]', 'jpg:-']
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Stdout: <too long to display (17283 bytes)>
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Stderr: b''
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Return code: 0
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Duration: 52.934000000000005
2022-11-02 09:28:01 thumbor:DEBUG [IM] Processing EXIF
2022-11-02 09:28:01 thumbor:DEBUG [ExiftoolRunner] command: ['/usr/bin/exiftool', '-all=', '-m', '-q', '-q', '/tmp/tmptfh3dr1x', '-o', '-']
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Command: ['/usr/bin/timeout', '--foreground', '59', '/usr/bin/exiftool', '-all=', '-m', '-q', '-q', '/tmp/tmptfh3dr1x', '-o', '-']
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Stdout: <too long to display (17204 bytes)>
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Stderr: b''
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Return code: 0
2022-11-02 09:28:01 thumbor:DEBUG [ShellRunner] Duration: 206.163
2022-11-02 09:28:01 tornado.access:INFO 304 GET /thumbor/unsafe/320x/https://upload.wikimedia.beta.wmflabs.org/wikipedia/en/1/1b/CuteGoat.jpg (127.0.0.1) 2091.99ms
2022-11-02 09:28:01 tornado.access:WARNING 404 GET /favicon.ico (127.0.0.1) 2.82ms

I guess the section of interest is:

... '/usr/bin/convert', '-define', 'tiff:exif-properties=no', '-define', 'jpeg:size=640x449', '-resize', '320x224^', '-gravity', 'center', '-extent', '320x224', '-quality', '87', '-sampling-factor', '4:2:0', '/tmp/tmprke8adzw[0]', 'jpg:-' ...