Include pixel format depth when reading metadata

This commit is contained in:
Lovell Fuller
2017-05-07 09:29:38 +01:00
parent c41d755441
commit 95850d75f6
6 changed files with 85 additions and 90 deletions

View File

@@ -57,6 +57,7 @@ class MetadataWorker : public Nan::AsyncWorker {
baton->height = image.height();
baton->space = vips_enum_nick(VIPS_TYPE_INTERPRETATION, image.interpretation());
baton->channels = image.bands();
baton->depth = vips_enum_nick(VIPS_TYPE_BAND_FORMAT, image.format());
if (sharp::HasDensity(image)) {
baton->density = sharp::GetDensity(image);
}
@@ -103,6 +104,7 @@ class MetadataWorker : public Nan::AsyncWorker {
Set(info, New("height").ToLocalChecked(), New<v8::Uint32>(baton->height));
Set(info, New("space").ToLocalChecked(), New<v8::String>(baton->space).ToLocalChecked());
Set(info, New("channels").ToLocalChecked(), New<v8::Uint32>(baton->channels));
Set(info, New("depth").ToLocalChecked(), New<v8::String>(baton->depth).ToLocalChecked());
if (baton->density > 0) {
Set(info, New("density").ToLocalChecked(), New<v8::Uint32>(baton->density));
}

View File

@@ -29,6 +29,7 @@ struct MetadataBaton {
int height;
std::string space;
int channels;
std::string depth;
int density;
bool hasProfile;
bool hasAlpha;