sharp
sharp copied to clipboard
withoutEnlargement=true should not take effect when input is SVG or PDF
We always set withoutEnlargement=true
when processing images. This prevents image upscaling if width supplied is larger than needed.
This should ideally be ignored by sharp library when input is vector. SVG or PDF have no inherent width and with latest sharp update, the correct density for given width is automatically determined. This should ideally make withoutEnlargement
flag ineffective. Problem happens when withoutEnlargement=true
and we try to set something like width:2000
. It never outputs that big image.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
Please provide sample image(s) that help explain this problem
@adityapatadia Were you able to make any progress with providing the requested information?
I can provide a code when I get time but the behaviour is exactly what I described. Take SVG as input image and try to output say 3000 pixel width while passing withoutEnlagement: true. It will never output big image while ideally it should as input is vector and enlargement does not apply to vectors.
Closing due to inactivity but please feel free to reopen with the requested details if further help is required.
FWIW, you can just omit the withoutEnlargement=true
parameter when resizing vector images. I think producing a different image based on the image type would certainly make things too complicated and confusing.
See also the discussion in: https://github.com/weserv/images/issues/333.