A couple of image code tweaks
This commit is contained in:
parent
274f11bb76
commit
a3f2bd4c7e
3 changed files with 6 additions and 7 deletions
|
@ -36,8 +36,9 @@ Napi::Value Deepfry(const Napi::CallbackInfo &info) {
|
||||||
|
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t length;
|
size_t length;
|
||||||
final.write_to_buffer(("." + type).c_str(), &buf, &length,
|
final.write_to_buffer(
|
||||||
VImage::option()->set("dither", 0));
|
("." + type).c_str(), &buf, &length,
|
||||||
|
type == "gif" ? VImage::option()->set("dither", 0) : 0);
|
||||||
|
|
||||||
vips_thread_shutdown();
|
vips_thread_shutdown();
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,9 @@ Napi::Value Jpeg(const Napi::CallbackInfo &info) {
|
||||||
|
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t length;
|
size_t length;
|
||||||
final.write_to_buffer(("." + type).c_str(), &buf, &length,
|
final.write_to_buffer(
|
||||||
VImage::option()->set("dither", 0));
|
("." + type).c_str(), &buf, &length,
|
||||||
|
type == "gif" ? VImage::option()->set("dither", 0) : 0);
|
||||||
|
|
||||||
vips_thread_shutdown();
|
vips_thread_shutdown();
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ Napi::Value Magik(const Napi::CallbackInfo &info) {
|
||||||
Napi::Object obj = info[0].As<Napi::Object>();
|
Napi::Object obj = info[0].As<Napi::Object>();
|
||||||
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
|
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
|
||||||
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
||||||
int delay =
|
|
||||||
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
|
|
||||||
|
|
||||||
Blob blob;
|
Blob blob;
|
||||||
|
|
||||||
|
@ -45,7 +43,6 @@ Napi::Value Magik(const Napi::CallbackInfo &info) {
|
||||||
for (Image &image : blurred) {
|
for (Image &image : blurred) {
|
||||||
image.quantizeDitherMethod(FloydSteinbergDitherMethod);
|
image.quantizeDitherMethod(FloydSteinbergDitherMethod);
|
||||||
image.quantize();
|
image.quantize();
|
||||||
if (delay != 0) image.animationDelay(delay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue