mirror of
https://github.com/lovell/sharp.git
synced 2025-07-11 11:30:15 +02:00
Expose palette-bit-depth metadata, requires upcoming libvips v8.8.0
This commit is contained in:
parent
30ca424942
commit
cc1d4c1a6d
@ -68,6 +68,9 @@ class MetadataWorker : public Nan::AsyncWorker {
|
|||||||
if (image.get_typeof("interlaced") == G_TYPE_INT) {
|
if (image.get_typeof("interlaced") == G_TYPE_INT) {
|
||||||
baton->isProgressive = image.get_int("interlaced") == 1;
|
baton->isProgressive = image.get_int("interlaced") == 1;
|
||||||
}
|
}
|
||||||
|
if (image.get_typeof("palette-bit-depth") == G_TYPE_INT) {
|
||||||
|
baton->paletteBitDepth = image.get_int("palette-bit-depth");
|
||||||
|
}
|
||||||
baton->hasProfile = sharp::HasProfile(image);
|
baton->hasProfile = sharp::HasProfile(image);
|
||||||
// Derived attributes
|
// Derived attributes
|
||||||
baton->hasAlpha = sharp::HasAlpha(image);
|
baton->hasAlpha = sharp::HasAlpha(image);
|
||||||
@ -140,6 +143,9 @@ class MetadataWorker : public Nan::AsyncWorker {
|
|||||||
New<v8::String>(baton->chromaSubsampling).ToLocalChecked());
|
New<v8::String>(baton->chromaSubsampling).ToLocalChecked());
|
||||||
}
|
}
|
||||||
Set(info, New("isProgressive").ToLocalChecked(), New<v8::Boolean>(baton->isProgressive));
|
Set(info, New("isProgressive").ToLocalChecked(), New<v8::Boolean>(baton->isProgressive));
|
||||||
|
if (baton->paletteBitDepth > 0) {
|
||||||
|
Set(info, New("paletteBitDepth").ToLocalChecked(), New<v8::Uint32>(baton->paletteBitDepth));
|
||||||
|
}
|
||||||
Set(info, New("hasProfile").ToLocalChecked(), New<v8::Boolean>(baton->hasProfile));
|
Set(info, New("hasProfile").ToLocalChecked(), New<v8::Boolean>(baton->hasProfile));
|
||||||
Set(info, New("hasAlpha").ToLocalChecked(), New<v8::Boolean>(baton->hasAlpha));
|
Set(info, New("hasAlpha").ToLocalChecked(), New<v8::Boolean>(baton->hasAlpha));
|
||||||
if (baton->orientation > 0) {
|
if (baton->orientation > 0) {
|
||||||
|
@ -33,6 +33,7 @@ struct MetadataBaton {
|
|||||||
int density;
|
int density;
|
||||||
std::string chromaSubsampling;
|
std::string chromaSubsampling;
|
||||||
bool isProgressive;
|
bool isProgressive;
|
||||||
|
int paletteBitDepth;
|
||||||
bool hasProfile;
|
bool hasProfile;
|
||||||
bool hasAlpha;
|
bool hasAlpha;
|
||||||
int orientation;
|
int orientation;
|
||||||
@ -53,6 +54,7 @@ struct MetadataBaton {
|
|||||||
channels(0),
|
channels(0),
|
||||||
density(0),
|
density(0),
|
||||||
isProgressive(false),
|
isProgressive(false),
|
||||||
|
paletteBitDepth(0),
|
||||||
hasProfile(false),
|
hasProfile(false),
|
||||||
hasAlpha(false),
|
hasAlpha(false),
|
||||||
orientation(0),
|
orientation(0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user