I have a photo which is a rectangle and I want to resize it down to a square while preserving the aspect ratio. Libraries like Sharp allow you to do that by applying letterboxing to the resulting image.
await sharp(photoBuffer).resize({ width: 200, height: 200, fit: 'contain' })
This is the result:
Instead of applying letterboxing I'd like the remaining empty space to be filled with a 2nd blurred version of the image, placed behind the resized one, like so:
Is there a Node.js library that does that out of the box or some custom way of achieving this ?