tachyon icon indicating copy to clipboard operation
tachyon copied to clipboard

Upgrade sharp to 0.33.4

Open joehoyle opened this issue 1 year ago • 4 comments

joehoyle avatar Jul 25 '24 14:07 joehoyle

This appears to be an issue with https://github.com/lovell/sharp/issues/4163 with pre-built binaries

joehoyle avatar Jul 25 '24 14:07 joehoyle

I think this might be due to the overly-restrictive peerDependencies of the smartcrop-sharp dependency - see https://github.com/jwagner/smartcrop-sharp/pull/32

If you weren't already aware, sharp provides a smartcrop feature via a position of "entropy" or "attention".

await sharp(input).resize({ width, height, position: "entropy" })...

https://sharp.pixelplumbing.com/api-resize#resize

lovell avatar Jul 27 '24 07:07 lovell

Thanks @lovell (and thanks for the great library!). Might be a good idea for us to reduce our dependencies here if the behaviour is equivalent.

I'm not sure to the extent we're using smart cropping, or what the impact of switching would be; the only mention of it in tachyon-plugin in the docs, albeit we appear to be using it in smart-media for resizes (but not crops).

@roborourke Any insight on this?

rmccue avatar Aug 02 '24 12:08 rmccue

The behaviour isn’t equivalent unfortunately or I would agree on reducing dependencies. The smartcrop-sharp library is a wrapper around https://github.com/jwagner/smartcrop.js so we could perhaps switch to using that directly instead to avoid the extra dependency.

The smartcrop.js results are generally better in my testing than entropy or attention especially when it comes to faces and people which is why I implemented it in Tachyon and used it as the default in Altis.

roborourke avatar Aug 11 '24 15:08 roborourke