mirror of
https://github.com/lovell/sharp.git
synced 2025-07-10 19:10:14 +02:00
Only set density option when using magick loader
to reduce number of warnings from libvips #352
This commit is contained in:
parent
0e29c55d13
commit
736c04a7a4
@ -29,6 +29,10 @@
|
|||||||
[#347](https://github.com/lovell/sharp/issues/347)
|
[#347](https://github.com/lovell/sharp/issues/347)
|
||||||
[@oaleynik](https://github.com/oaleynik)
|
[@oaleynik](https://github.com/oaleynik)
|
||||||
|
|
||||||
|
* Ensure default crop gravity is center/centre.
|
||||||
|
[#351](https://github.com/lovell/sharp/pull/351)
|
||||||
|
[@joelmukuthu](https://github.com/joelmukuthu)
|
||||||
|
|
||||||
* Small optimisation when reducing by an integral factor to favour shrink over affine.
|
* Small optimisation when reducing by an integral factor to favour shrink over affine.
|
||||||
|
|
||||||
* Add support for gamma correction of images with an alpha channel.
|
* Add support for gamma correction of images with an alpha channel.
|
||||||
|
@ -39,6 +39,7 @@ using Nan::Equals;
|
|||||||
|
|
||||||
using vips::VImage;
|
using vips::VImage;
|
||||||
using vips::VInterpolate;
|
using vips::VInterpolate;
|
||||||
|
using vips::VOption;
|
||||||
using vips::VError;
|
using vips::VError;
|
||||||
|
|
||||||
using sharp::Composite;
|
using sharp::Composite;
|
||||||
@ -222,11 +223,11 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
inputImageType = DetermineImageType(baton->bufferIn, baton->bufferInLength);
|
inputImageType = DetermineImageType(baton->bufferIn, baton->bufferInLength);
|
||||||
if (inputImageType != ImageType::UNKNOWN) {
|
if (inputImageType != ImageType::UNKNOWN) {
|
||||||
try {
|
try {
|
||||||
image = VImage::new_from_buffer(
|
VOption *option = VImage::option()->set("access", baton->accessMethod);
|
||||||
baton->bufferIn, baton->bufferInLength, nullptr, VImage::option()
|
if (inputImageType == ImageType::MAGICK) {
|
||||||
->set("access", baton->accessMethod)
|
option->set("density", baton->density.data());
|
||||||
->set("density", baton->density.data())
|
}
|
||||||
);
|
image = VImage::new_from_buffer(baton->bufferIn, baton->bufferInLength, nullptr, option);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
(baton->err).append("Input buffer has corrupt header");
|
(baton->err).append("Input buffer has corrupt header");
|
||||||
inputImageType = ImageType::UNKNOWN;
|
inputImageType = ImageType::UNKNOWN;
|
||||||
@ -240,11 +241,11 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
inputImageType = DetermineImageType(baton->fileIn.data());
|
inputImageType = DetermineImageType(baton->fileIn.data());
|
||||||
if (inputImageType != ImageType::UNKNOWN) {
|
if (inputImageType != ImageType::UNKNOWN) {
|
||||||
try {
|
try {
|
||||||
image = VImage::new_from_file(
|
VOption *option = VImage::option()->set("access", baton->accessMethod);
|
||||||
baton->fileIn.data(), VImage::option()
|
if (inputImageType == ImageType::MAGICK) {
|
||||||
->set("access", baton->accessMethod)
|
option->set("density", baton->density.data());
|
||||||
->set("density", baton->density.data())
|
}
|
||||||
);
|
image = VImage::new_from_file(baton->fileIn.data(), option);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
(baton->err).append("Input file has corrupt header");
|
(baton->err).append("Input file has corrupt header");
|
||||||
inputImageType = ImageType::UNKNOWN;
|
inputImageType = ImageType::UNKNOWN;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"description": "Benchmark and performance tests for sharp",
|
"description": "Benchmark and performance tests for sharp",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node perf && node random && node parallel"
|
"test": "VIPS_WARNING=0 node perf && node random && node parallel"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^1.5.2",
|
"async": "^1.5.2",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user