Coder Social home page Coder Social logo

Comments (10)

jcupitt avatar jcupitt commented on May 24, 2024

All libvips save operations have a background argument you can use to set the colour an alpha channel is flattened out with. For example:

$ vips copy a.png x.jpg[background=255]
$ vips copy a.png x.jpg[background="255 128 128"]

from vips.

alehano avatar alehano commented on May 24, 2024

Is there an API in go code?

from vips.

foresmac avatar foresmac commented on May 24, 2024

@jcupitt Will libvips not maintain alpha channels?

from vips.

jcupitt avatar jcupitt commented on May 24, 2024

@foresmac libvips keeps the alpha if you resize png -> png.

This issue (I think?) is resizing png -> jpg. In this case, libvips defaults to a black background and if you need a different colour, you have to specify it.

from vips.

foresmac avatar foresmac commented on May 24, 2024

@jcupitt Ah, this is apparently the exact problem we were having. Thanks for the insight!

from vips.

foresmac avatar foresmac commented on May 24, 2024

Looks like vips is always using JPEG output: https://github.com/DAddYE/vips/blob/master/vips.go#L318

from vips.

DAddYE avatar DAddYE commented on May 24, 2024

The reason is that png is petty slow and the aim of the library was to make resize fast.

from vips.

foresmac avatar foresmac commented on May 24, 2024

@DAddYE Understandable.

from vips.

DAddYE avatar DAddYE commented on May 24, 2024

But yes, it's not hard to make it work with png too ;)

from vips.

bgentry avatar bgentry commented on May 24, 2024

I would also like to see support for keeping PNGs as PNGs 👍

Thanks for making this library!

from vips.

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.