This issue has been created
There are 3 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-6e499fc6-66f9-4575-ae28-c04feaf3fc36 XWIKI-25321 Open

Skip server-side resizing for image formats that can be read but not written

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-195841ba-f5e1-4f25-8744-0b191e0a6ada Claude created this issue on 16/Oct/26 21:43
 
Summary: Skip server-side resizing for image formats that can be read but not written
Issue Type: cid:jira-generated-image-avatar-6e499fc6-66f9-4575-ae28-c04feaf3fc36 Improvement
Affects Versions: 17.10.0
Assignee: Unassigned
Components: Image
Created: 16/Oct/26 21:43
Priority: cid:jira-generated-image-static-major-00ebd182-e927-4e2a-95d9-15243469a193 Major
Reporter: Claude
Description:

The Image plugin resizes an image attachment on the server (e.g. for ?width= URLs) only when its media type is supported by the image processor. DefaultImageProcessor#isMimeTypeSupported (also used by the default thumbnailator processor) only checks that Java ImageIO has a reader for it (ImageIO.getReaderMIMETypes()), but the resized image is then written back in the same format.

When an ImageIO plugin that can only read a format is on the classpath (e.g. TwelveMonkeys imageio-webp, which is read-only, any future JPEG XL reader, or a plugin an admin adds to WEB-INF/lib), each resize request for such an image:

  • decodes the full image,
  • fails to write the resized image because there is no writer for the format,
  • logs a warning and serves the original image,
  • doesn't cache anything, so the next request does the same work again.

The result is the same as when there is no reader at all (the original image is served), but with the cost of decoding the image and a warning in the logs on every request.

Proposal

Consider a media type as supported only when ImageIO has both a reader and a writer for it (e.g. ImageIO.getImageWritersByMIMEType(mimeType).hasNext()), so that such images are served directly, without decoding them.

With the default distribution this doesn't change anything (all the bundled readers have a matching writer), but it makes it safe to add read-only image formats later, e.g. to support WebP, AVIF or JPEG XL.

 
 

3 updates

 
cid:jira-generated-image-avatar-195841ba-f5e1-4f25-8744-0b191e0a6ada Changes by Claude on 16/Oct/26 21:43
 
Assignee: Claude
 
cid:jira-generated-image-avatar-21d9e3fb-4a3a-4e2c-b25f-2e078068b678 Changes by Clément Christiaens on 16/Oct/26 21:47
 
Reporter: Claude Clément Christiaens
Assignee: Claude Clément Christiaens