Coder Social home page Coder Social logo

Comments (2)

valerian avatar valerian commented on June 29, 2024 1

Thanks @mhulse for your very helpful explanation, this was indeed not obvious at all, and this is the only place where I found some clarification.

However it's still not completely clear: does that mean that the width and height from the options are only there to provide an aspect ratio of the desired crop? Multiplying or dividing them does not seem to affect the result at all.

From experimenting it seems that the minScale and maxScale options, when they have their 1.0 default value, make the crop result always have either 100% of the width or 100% of the height of the original image.
Lowering them allows smartcrop to also try to return potentially smaller crop sizes.

from smartcrop.js.

jwagner avatar jwagner commented on June 29, 2024

Based on your input image size, and desired crop area, the resulting relative crop area is (width) and (height) at coordinates (x) and (y). You must crop your image using smartcrop's output width, height, x, y, and then scale up or down to your desired width and height (using tool of choice, like ImageMagick or GraphicsMagick).

This is correct. It seemed obvious to me but I guess it's not. I'll try to add some clarification in the next release. Thanks for sharing this.

from smartcrop.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.