Crop area calculator
Given a focal point, an aspect ratio and source image dimensions this module will calculate a crop starting point (x1
, y1
) and end point (x2
, y2
).
These values can be used for fixed coordinates cropping with tools like e.g. ImageMagick/GraphicsMagick or a service like Cloudinary.
This algorithm has been implemented in the EPiFocalPoint plugin for EpiServer.
Demo
Check out this link or demo.html
for an example use case.
How to use
Either npm install --save crop-area-calculator
and import it in your own code or go the old school route and download the script file from the dist
folder and include it in your page with a <script>
tag.
License
MIT © Jonathan Persson