/fit-in not working with 4.0.0
See original GitHub issueUsing /fit-in/AxB/
is cropping images rather than fitting them within the dimensions specified.
Example: https://i1rk6c9qi5.execute-api.us-east-1.amazonaws.com/image/100x100/bart.png
A workaround to fit an image into the resize area is to use the upscale filter:
https://i1rk6c9qi5.execute-api.us-east-1.amazonaws.com/image/200x50/filters:upscale()/bart.png
The fix for this might be in the process(event)
function:
… the this.edits.resize.fit = 'inside'
needs to be set, the same as what happens in the upscale()
filter.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top Results From Across the Web
fit-in not working with 4.0.0 · Issue #114 - GitHub
Using /fit-in/AxB/ is cropping images rather than fitting them within the dimensions specified.
Read more >Could not load file or assembly "System.Net.Http, Version=4.0 ...
Net.Http v 4.0.0 , i just installed System.Net.Http nuget package in my startup project and the problem solved ... This will work in...
Read more >Dealing with R 4.0 - RStan - The Stan Forums
I've found out that this is a problem of the package parallel from R-4.0.0 I've found this recently issue in RStudio's GitHub that...
Read more >Runtime Changes for Migration from .NET Framework 4.0 to 4.8
Find information about application compatibility issues from runtime changes that might affect your app when migrating from .
Read more >Upgrade to Prisma 4
Prisma 4 introduces a number of breaking changes when you upgrade from an earlier Prisma version. This guide explains how this upgrade might...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have updated our solution, and I believe your issue has been fixed. If you still see the issue with the latest version (v4.2), please feel free to reopen the issue.
You can refer to the recent changes here
Hi @tjw0051 we faced a similar issue. fit-in from thumbor isn’t translated here correctly.
That’s because they aren’t passing anything to resize. While ‘inside’ is the right way forward ( because it preserves aspect ratio ) for us this leads to another issue. For eg: if we pass 500x500 as the size, we want image to be resized based on aspect ratio but we should be able to ‘fill’ the remaining area with color of our choice.
This is how we did in thumbor:
https://<our_cf_url>/fit-in/500x500/filters:quality(90):fill(fff)/my_source.jpg
If we use ‘inside’, we get back an image with aspect ratio maintained, but we aren’t able to fill it with white color so as to get back 500x500 final product.
options.background can only be used with ‘contain’. https://sharp.pixelplumbing.com/en/stable/api-resize/
So, if this was instead using
this.edits.resize.fit = ‘contain’,
we could pass
sharp(input) .resize(200, 300, { kernel: sharp.kernel.nearest, fit: ‘contain’, position: ‘right top’, background: { r: 255, g: 255, b: 255, alpha: 0.5 } }) .toFile(‘output.png’) .then(() => { // output.png is a 200 pixels wide and 300 pixels high image // containing a nearest-neighbour scaled version // contained within the north-east corner of a semi-transparent white canvas });