GithubHelp home page GithubHelp logo

no crop nor embed about sharp HOT 3 CLOSED

lovell avatar lovell commented on May 13, 2024
no crop nor embed

from sharp.

Comments (3)

lovell avatar lovell commented on May 13, 2024

I may need a worked example to understand what you're trying to achieve. Are you looking for a hybrid approach where the image is partially resized then any remainder cropped? Could your idea relate to not maintaining aspect ratio?

Width and height are currently both optional. After resizing, if the width and height already exactly match the required dimensions then the crop/embed step is skipped.

from sharp.

pierreinglebert avatar pierreinglebert commented on May 13, 2024

It maintains aspect ratio but the arguments passed to resize are a "max", not a perfect match.
For example, a 4000x3000px image resized with (200, 200) will be 200x150px

from sharp.

lovell avatar lovell commented on May 13, 2024

Got it, thanks. What you suggest is (I think) the default behaviour of GraphicsMagick's geometry option.

It would be hard to provide a less intuitive API for this than GM's punctuating ^!@...

Anyway, this max() option would be another canvas setting, mutually exclusive of the existing crop() and embed*() methods/settings/options. Internally options.canvas is represented as a single character String to make the transition from JavaScript to C++ as simple as possible.

from sharp.

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.