Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdaptiveImage: Configurability of when to apply transformation by file type #2530

Open
Stefan-Franck opened this issue Jun 22, 2023 · 1 comment · May be fixed by #2534
Open

AdaptiveImage: Configurability of when to apply transformation by file type #2530

Stefan-Franck opened this issue Jun 22, 2023 · 1 comment · May be fixed by #2534

Comments

@Stefan-Franck
Copy link

Feature Request

Whether the AdaptiveImage delivers the original or applies transformations is fixed: svgs and gifs are never transformed, other images are only transformed if there is a transformation applied (e.g. rotation, cropping, flipping). As the transformation also includes compression for jpg images which is defined system-wide, we have editors cropping images by one pixel just to make sure the compression is applied - and frequently it is overlooked, causing large image downloads impacting green web policies and site performance (CoreWebVitals affected).

It would be great to allow configuring the transformation more closely via OSGi settings: defining which image types are always transformed and which are never transformed. This would allow preventing transformation in other formats (e.g. optimized webp rendition already available, should be delivered as is). Additionally, if one sets up compression for jpegs, one could force the transformation process (incl. compression) of all jpegs even if no manual transformation is defined.

An alternative would be to include compression in the delivery of any jpg, but that would leave less flexibility to individual projects and would impact existing solutions.

@kwin
Copy link
Contributor

kwin commented Jun 23, 2023

SVG and GIFs cannot be transformed by the underlying image library (com.day.image) and therefore always need to be excluded from any transformations: SVG because it is a vector format and the image library only supports rasterized image formats and GIF because it may contain animations which are removed through transformations. WebP is also not supported by the image library (AFAIK) so it may be good idea to add that to the hardcoded exclusions as well.

The Day image library is a small layer on top of javax.imageio which only supports the formats outlined in https://docs.oracle.com/javase/8/docs/api/javax/imageio/package-summary.html by default (although it can be extended through Image IO plugins).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants