mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Only set density option when using magick loader
to reduce number of warnings from libvips #352
This commit is contained in:
@@ -39,6 +39,7 @@ using Nan::Equals;
|
||||
|
||||
using vips::VImage;
|
||||
using vips::VInterpolate;
|
||||
using vips::VOption;
|
||||
using vips::VError;
|
||||
|
||||
using sharp::Composite;
|
||||
@@ -222,11 +223,11 @@ class PipelineWorker : public AsyncWorker {
|
||||
inputImageType = DetermineImageType(baton->bufferIn, baton->bufferInLength);
|
||||
if (inputImageType != ImageType::UNKNOWN) {
|
||||
try {
|
||||
image = VImage::new_from_buffer(
|
||||
baton->bufferIn, baton->bufferInLength, nullptr, VImage::option()
|
||||
->set("access", baton->accessMethod)
|
||||
->set("density", baton->density.data())
|
||||
);
|
||||
VOption *option = VImage::option()->set("access", baton->accessMethod);
|
||||
if (inputImageType == ImageType::MAGICK) {
|
||||
option->set("density", baton->density.data());
|
||||
}
|
||||
image = VImage::new_from_buffer(baton->bufferIn, baton->bufferInLength, nullptr, option);
|
||||
} catch (...) {
|
||||
(baton->err).append("Input buffer has corrupt header");
|
||||
inputImageType = ImageType::UNKNOWN;
|
||||
@@ -240,11 +241,11 @@ class PipelineWorker : public AsyncWorker {
|
||||
inputImageType = DetermineImageType(baton->fileIn.data());
|
||||
if (inputImageType != ImageType::UNKNOWN) {
|
||||
try {
|
||||
image = VImage::new_from_file(
|
||||
baton->fileIn.data(), VImage::option()
|
||||
->set("access", baton->accessMethod)
|
||||
->set("density", baton->density.data())
|
||||
);
|
||||
VOption *option = VImage::option()->set("access", baton->accessMethod);
|
||||
if (inputImageType == ImageType::MAGICK) {
|
||||
option->set("density", baton->density.data());
|
||||
}
|
||||
image = VImage::new_from_file(baton->fileIn.data(), option);
|
||||
} catch (...) {
|
||||
(baton->err).append("Input file has corrupt header");
|
||||
inputImageType = ImageType::UNKNOWN;
|
||||
|
||||
Reference in New Issue
Block a user