Sharp: Retrieve coordinates from Entropy and Attention crop

Created on 10 Jul 2017  路  5Comments  路  Source: lovell/sharp

Is there a way to get the coordinates used for the sharp.strategy.entropy or sharp.strategy.attention crop?

I want to be able to store the crop data to database as x,y,width,height so that I can generate a cropbox on the front-end to match the already cropped thumbnail when users try to manually adjust it crop. Right now I'm placing the cropbox in the center which is confusing because it doesn't match the current thumbnail. Here's what I want the cropbox to look like: (matching the entropy-based thumbnail)
2017-07-09_221622

enhancement ready-to-ship

Most helpful comment

sharp v0.19.0 now available.

All 5 comments

Hello, this was previously available (up to v0.17.x) in undocumented/unsupported properties in the info part of the output.

To provide this in a supported manner we'd need to expose the results from libvips' smartcrop operation (which used and improved upon some of the original sharp logic of the same name).

Hey @lovell will cropOffsetLeft / cropOffsetTop be available using toBuffer() method?

Looking forward to v0.19.0!

@homerjam Yes, I've updated the docs in commit 7067bed to make this clearer.

sharp v0.19.0 now available.

Was this page helpful?
0 / 5 - 0 ratings