Comments (14)
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.
Thank you for the report. It was saving RGBA as CMYK jpg, with comical results. Here's a fix for master:
I'll try to backport to 7.28.
from libvips.
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.
holy shit, this was the most professionally done response with instant supplied fix in history of github.
mind = blown.
from libvips.
Embarrassment is a great motivator :-(
from libvips.
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.
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.
Awesome, thanks.
from libvips.
I don't understand that being expected behavior. How do I preserve the transparency?
from libvips.
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.
@jcupitt - Awesome, thanks. I didn't realize that jpeg was the default.
from libvips.
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.
And this doesn't seem to work vipsthumbnail rtd-img.png -o x.jpg[background=255]
with me.
from libvips.
never mind it works i was using zsh and i had to give it inside quote Thank u :)
from libvips.
Related Issues (20)
- Loading images with jpegli fails with "No SOS marker found." HOT 2
- jxlsave fails with "jxlsave: error JxlEncoderSetBasicInfo" for a 32-bit (?) CMYK colour TIFF HOT 2
- Quality handling in WebP near-lossless (and arguably lossless) mode is incorrect HOT 3
- Conversion to PFM gives incorrect output HOT 2
- Improve `tilecache` performance
- JXL Support in Libvips Web Build HOT 3
- vips: unknown action "dzsave", vips-8.15.1 on Gentoo HOT 1
- Row sums from vips_project do not necessarily give the same value like summing img(i,j) along i HOT 2
- Looks like 8.15.2 tag is wrong? HOT 1
- vips 8.15.2 failed to build with latest xcode HOT 11
- HDR AVIF to HEIC (hdr) HOT 4
- Feature request: Support SDR→HDR via RTX HDR (upmapping / inverse tone mapping)
- AVIF with bitdepth 10 or 12 crashes
- Add nclx->icc colour management to heifload HOT 24
- Segmentation fault when performing very large number of operations HOT 1
- Subsample mode not working with jpegli HOT 4
- Add target write to `rawsave` HOT 2
- Cannot link to proper libraries on Windows 11 Pro. HOT 1
- Thumbnail/Resize removes color on Alpine HOT 1
- Add support for fractional tiff values (eg. 10 or 12 bits per pixel) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libvips.