mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Switch to libvips' recently-exposed has_alpha #2569
This commit is contained in:
parent
9f2f92095d
commit
cc37b59309
@ -6,6 +6,9 @@ Requires libvips v8.10.5
|
|||||||
|
|
||||||
### v0.27.2 - TBD
|
### v0.27.2 - TBD
|
||||||
|
|
||||||
|
* Improve 16-bit grey+alpha support by using libvips' `has_alpha` detection.
|
||||||
|
[#2569](https://github.com/lovell/sharp/issues/2569)
|
||||||
|
|
||||||
* Allow the use of non lower case extensions with `toFormat`.
|
* Allow the use of non lower case extensions with `toFormat`.
|
||||||
[#2581](https://github.com/lovell/sharp/pull/2581)
|
[#2581](https://github.com/lovell/sharp/pull/2581)
|
||||||
[@florian-busch](https://github.com/florian-busch)
|
[@florian-busch](https://github.com/florian-busch)
|
||||||
|
@ -421,12 +421,7 @@ namespace sharp {
|
|||||||
Uses colour space interpretation with number of channels to guess this.
|
Uses colour space interpretation with number of channels to guess this.
|
||||||
*/
|
*/
|
||||||
bool HasAlpha(VImage image) {
|
bool HasAlpha(VImage image) {
|
||||||
int const bands = image.bands();
|
return image.has_alpha();
|
||||||
VipsInterpretation const interpretation = image.interpretation();
|
|
||||||
return (
|
|
||||||
(bands == 2 && interpretation == VIPS_INTERPRETATION_B_W) ||
|
|
||||||
(bands == 4 && interpretation != VIPS_INTERPRETATION_CMYK) ||
|
|
||||||
(bands == 5 && interpretation == VIPS_INTERPRETATION_CMYK));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user