mirror of
https://github.com/lovell/sharp.git
synced 2026-02-12 17:46:13 +01:00
Add autoOrient operation and constructor option #4144
This commit is contained in:
committed by
Lovell Fuller
parent
b7ff2645c4
commit
14c83e1f4c
@@ -242,6 +242,15 @@ class MetadataWorker : public Napi::AsyncWorker {
|
||||
if (baton->orientation > 0) {
|
||||
info.Set("orientation", baton->orientation);
|
||||
}
|
||||
Napi::Object autoOrient = Napi::Object::New(env);
|
||||
info.Set("autoOrient", autoOrient);
|
||||
if (baton->orientation >= 5) {
|
||||
autoOrient.Set("width", baton->height);
|
||||
autoOrient.Set("height", baton->width);
|
||||
} else {
|
||||
autoOrient.Set("width", baton->width);
|
||||
autoOrient.Set("height", baton->height);
|
||||
}
|
||||
if (baton->exifLength > 0) {
|
||||
info.Set("exif", Napi::Buffer<char>::NewOrCopy(env, baton->exif, baton->exifLength, sharp::FreeCallback));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user