What's Changed
-
The convert and vipsthumbnail engines run their tools through
subprocess.run. This fixes a deadlock when a tool wrote more than the pipe buffer to stderr, and closes the pipes thatis_valid_imageand the size probes left open. A call that runs longer than the newTHUMBNAIL_COMMAND_TIMEOUTsetting, 60 seconds by default, is killed and raisesEngineError. Set it higher for large sources, or toNonefor the previous unbounded behaviour -
The vipsthumbnail engine no longer fails on any stderr output, which made every thumbnail fail on a libvips that prints a warning on startup. It checks the exit code like the convert engine does, and raises
EngineErrorinstead of a bareExceptionorAttributeErrorwhenvipsthumbnailorvipsheaderfail -
crop='smart'now returns the requested size. It could hang forever, raiseValueError, or return a thumbnail that was too narrow, like 44×200 for200x200(#829) -
Documented
crop='smart'. It only works with the PIL engine, and the other engines now say so in the error instead of raising an emptyNotImplementedError -
The convert engine raises an error when convert writes a different format than the one requested. Without an AVIF encoder, ImageMagick printed a warning, exited with 0 and wrote a JPEG, which was saved under an
.avifname (#837). Browsers displayed those files, so sites that ask for AVIF on such a machine will now see the thumbnail tag fail instead. Installlibheif-plugin-aomencor ask for WEBP. Thumbnails created before the upgrade keep working -
The PIL engine writes a greyscale source with an alpha channel (mode
LA) as JPEG instead of raisingOSError: cannot write mode RGBA as JPEG(#474) -
The PIL and wand engines now honour
THUMBNAIL_FLATTEN, which is now documented along with theflattenoption. A transparent source written as JPEG shows the color stored under its transparent pixels, usually black. With the setting on it is composited onto a white background, or the padding color when the thumbnail is padded (#474). The convert engine already flattened, and does so for every format, so its PNG, GIF and WEBP thumbnails lose their transparency too.flatten=Falsenow turns it off for one thumbnail, before only the string"off"did. The setting is not part of the thumbnail name, so thumbnails created before the upgrade keep their black background until you delete them, for example withmanage.py thumbnail clear_delete_all -
The cached DB key-value store writes every entry with a single upsert instead of a lookup followed by an insert or update, so creating a thumbnail runs six statements instead of nine. Oracle has no upsert in Django and keeps the two-step write (#451)
-
Documented
THUMBNAIL_FORCE_OVERWRITEand stopped recommending it for Amazon S3. On a key-value store miss it regenerates the thumbnail from the full-size source where the default makes oneHEADrequest, so with boto3 it makes S3 slower, not faster (#351) -
The convert engine now reports the padded size when
padding=True, soim.widthandim.heightmatch the file it wrote instead of the size before padding (#835) -
The PIL engine keeps animated GIFs animated when the thumbnail format is
GIF. Every frame is thumbnailed, keeping its duration and the loop count. Other formats still take the first frame (#687) -
UrlStorageno longer escapes+and/in the query string of remote image URLs, which broke signed URLs. Only applies withTHUMBNAIL_REMOVE_URL_ARGS = False, the default strips the query first -
The default branch is now
maininstead ofmaster. GitHub redirects links tomastertomain. To update an existing clone or fork:git branch -m master main git fetch origin git branch -u origin/main main git remote set-head origin -a
New Contributors
Full Changelog: 13.2.0...13.3.0