Giter VIP home page Giter VIP logo

Comments (14)

jcupitt avatar jcupitt commented on May 18, 2024 1

I've added a @background arg to save: jcupitt@b21c47b

Use like this:

$ vipsthumbnail rtd-img.png -o x.jpg[background=255]

It'll be in 7.42.

from libvips.

jcupitt avatar jcupitt commented on May 18, 2024

Thank you for the report. It was saving RGBA as CMYK jpg, with comical results. Here's a fix for master:

jcupitt@f07fb25

I'll try to backport to 7.28.

from libvips.

jcupitt avatar jcupitt commented on May 18, 2024

7.28 now seems to handle this correctly. I added a thing to flatten RGBA to RGB more carefully as well: before it was just throwing away the A channel, now it does a proper blend with a background colour.

I'll do another 7.28 release in a few days, or you could try building from git.

from libvips.

tobsn avatar tobsn commented on May 18, 2024

holy shit, this was the most professionally done response with instant supplied fix in history of github.

mind = blown.

from libvips.

jcupitt avatar jcupitt commented on May 18, 2024

Embarrassment is a great motivator :-(

from libvips.

FireGoblin avatar FireGoblin commented on May 18, 2024

I think this is back. I'm using vips-7.38.5 and vipsthumbnail converts transparent pngs to black background. Same thing also happens if I use batch_image_convert for the conversion.

folder with original png and thumbnailed jpg: https://www.dropbox.com/sh/pxfmd18pd4u2vin/AACUjmgWT_guVp90ZDCvuKzma?lst

from libvips.

jcupitt avatar jcupitt commented on May 18, 2024

That's expected behaviour: it flattens the image with a black background.

There maybe should be something to let you pick another colour, I suppose white will be the other common one. I'll have a look.

from libvips.

FireGoblin avatar FireGoblin commented on May 18, 2024

Awesome, thanks.

from libvips.

franklinwise avatar franklinwise commented on May 18, 2024

I don't understand that being expected behavior. How do I preserve the transparency?

from libvips.

jcupitt avatar jcupitt commented on May 18, 2024

Hi @franklinwise, this is if you thumbnail to a jpg image (the default). Jpeg does not support transparency, so you need to flatten it out with a background.

If you thumbnail to something like png, which does support transparency, it'll be kept.

vipsthumbnail file.png --format tn_%s.png

from libvips.

franklinwise avatar franklinwise commented on May 18, 2024

@jcupitt - Awesome, thanks. I didn't realize that jpeg was the default.

from libvips.

shilpi230 avatar shilpi230 commented on May 18, 2024

I have 7.42.2 I am also having same issue and i am converting from png to jpeg only how can i preserve the transparency ?

from libvips.

shilpi230 avatar shilpi230 commented on May 18, 2024

And this doesn't seem to work vipsthumbnail rtd-img.png -o x.jpg[background=255] with me.

from libvips.

shilpi230 avatar shilpi230 commented on May 18, 2024

never mind it works i was using zsh and i had to give it inside quote Thank u :)

from libvips.

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.