Some cleanup
This commit is contained in:
parent
d2a1ffe2de
commit
4f66bc51cd
3 changed files with 8 additions and 8 deletions
|
@ -14,8 +14,6 @@ Napi::Value Colors(const Napi::CallbackInfo &info) {
|
||||||
try {
|
try {
|
||||||
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>>();
|
||||||
bool old =
|
|
||||||
obj.Has("old") ? obj.Get("old").As<Napi::Boolean>().Value() : false;
|
|
||||||
string color = obj.Get("color").As<Napi::String>().Utf8Value();
|
string color = obj.Get("color").As<Napi::String>().Utf8Value();
|
||||||
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
||||||
int delay =
|
int delay =
|
||||||
|
|
|
@ -17,9 +17,11 @@ Napi::Value Deepfry(const Napi::CallbackInfo &info) {
|
||||||
|
|
||||||
Napi::Object result = Napi::Object::New(env);
|
Napi::Object result = Napi::Object::New(env);
|
||||||
|
|
||||||
VImage in = VImage::new_from_buffer(
|
VOption *options = VImage::option()->set("access", "sequential");
|
||||||
data.Data(), data.Length(), "",
|
|
||||||
VImage::option()->set("access", "sequential")->set("n", -1))
|
VImage in =
|
||||||
|
VImage::new_from_buffer(data.Data(), data.Length(), "",
|
||||||
|
type == "gif" ? options->set("n", -1) : options)
|
||||||
.colourspace(VIPS_INTERPRETATION_sRGB);
|
.colourspace(VIPS_INTERPRETATION_sRGB);
|
||||||
if (!in.has_alpha()) in = in.bandjoin(255);
|
if (!in.has_alpha()) in = in.bandjoin(255);
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ Napi::Value Uncaption(const Napi::CallbackInfo &info) {
|
||||||
int delay =
|
int delay =
|
||||||
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
|
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
|
||||||
|
|
||||||
VOption *options = VImage::option()->set("access", "sequential");
|
VOption *options = VImage::option();
|
||||||
|
|
||||||
VImage in =
|
VImage in =
|
||||||
VImage::new_from_buffer(data.Data(), data.Length(), "",
|
VImage::new_from_buffer(data.Data(), data.Length(), "",
|
||||||
type == "gif" ? options->set("n", -1) : options)
|
type == "gif" ? options->set("n", -1)->set("access", "sequential") : options)
|
||||||
.colourspace(VIPS_INTERPRETATION_sRGB);
|
.colourspace(VIPS_INTERPRETATION_sRGB);
|
||||||
if (!in.has_alpha()) in = in.bandjoin(255);
|
if (!in.has_alpha()) in = in.bandjoin(255);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue