mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Set PNG bitdepth based on number of colours #2855
Removes use of deprecated libvips API
This commit is contained in:
@@ -799,7 +799,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE)
|
||||
->set("palette", baton->pngPalette)
|
||||
->set("Q", baton->pngQuality)
|
||||
->set("colours", baton->pngColours)
|
||||
->set("bitdepth", baton->pngBitdepth)
|
||||
->set("dither", baton->pngDither)));
|
||||
baton->bufferOut = static_cast<char*>(area->data);
|
||||
baton->bufferOutLength = area->length;
|
||||
@@ -955,7 +955,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
->set("filter", baton->pngAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_ALL : VIPS_FOREIGN_PNG_FILTER_NONE)
|
||||
->set("palette", baton->pngPalette)
|
||||
->set("Q", baton->pngQuality)
|
||||
->set("colours", baton->pngColours)
|
||||
->set("bitdepth", baton->pngBitdepth)
|
||||
->set("dither", baton->pngDither));
|
||||
baton->formatOut = "png";
|
||||
} else if (baton->formatOut == "webp" || (mightMatchInput && isWebp) ||
|
||||
@@ -1429,7 +1429,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
|
||||
baton->pngAdaptiveFiltering = sharp::AttrAsBool(options, "pngAdaptiveFiltering");
|
||||
baton->pngPalette = sharp::AttrAsBool(options, "pngPalette");
|
||||
baton->pngQuality = sharp::AttrAsUint32(options, "pngQuality");
|
||||
baton->pngColours = sharp::AttrAsUint32(options, "pngColours");
|
||||
baton->pngBitdepth = sharp::AttrAsUint32(options, "pngBitdepth");
|
||||
baton->pngDither = sharp::AttrAsDouble(options, "pngDither");
|
||||
baton->webpQuality = sharp::AttrAsUint32(options, "webpQuality");
|
||||
baton->webpAlphaQuality = sharp::AttrAsUint32(options, "webpAlphaQuality");
|
||||
|
||||
@@ -146,7 +146,7 @@ struct PipelineBaton {
|
||||
bool pngAdaptiveFiltering;
|
||||
bool pngPalette;
|
||||
int pngQuality;
|
||||
int pngColours;
|
||||
int pngBitdepth;
|
||||
double pngDither;
|
||||
int webpQuality;
|
||||
int webpAlphaQuality;
|
||||
@@ -276,7 +276,7 @@ struct PipelineBaton {
|
||||
pngAdaptiveFiltering(false),
|
||||
pngPalette(false),
|
||||
pngQuality(100),
|
||||
pngColours(256),
|
||||
pngBitdepth(8),
|
||||
pngDither(1.0),
|
||||
webpQuality(80),
|
||||
webpAlphaQuality(100),
|
||||
|
||||
Reference in New Issue
Block a user