Giter Site home page Giter Site logo

Comments (3)

lovell avatar lovell commented on May 20, 2024 1

I'm OK with this being a breaking change, as part of a future possible v0.34.0, as it simplifies the API so that the background metadata can always be parsed by the color package and therefore operations that use it such as flatten().

Perhaps a single-channel input could return something like { grey: value } instead? The color package accepts values in the range 0-100 so we would need to scale from libvips' 0-255 range.

from sharp.

lovell avatar lovell commented on May 20, 2024

The simplest solution here is probably to always return an RGB Object in metadata.background regardless of the number of input channels.

Happy to accept a PR for this, if you're able. We should add a test case for this too as it doesn't appear to be covered by any of the scenarios in test/unit/metadata.js at the moment.

from sharp.

Zirafnik avatar Zirafnik commented on May 20, 2024

Removing greyscale number return type from .metadata() would be a breaking change for anybody that confidently relies on receiving just the number.

Adding additional parameter type for .flatten() background to include a number, is not a breaking change.

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.