Some cleanup

This commit is contained in:
Essem 2022-06-06 19:16:14 -05:00
parent d2a1ffe2de
commit 4f66bc51cd
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 8 additions and 8 deletions

View file

@ -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 =

View file

@ -17,10 +17,12 @@ 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 =
.colourspace(VIPS_INTERPRETATION_sRGB); VImage::new_from_buffer(data.Data(), data.Length(), "",
type == "gif" ? options->set("n", -1) : options)
.colourspace(VIPS_INTERPRETATION_sRGB);
if (!in.has_alpha()) in = in.bandjoin(255); if (!in.has_alpha()) in = in.bandjoin(255);
int page_height = vips_image_get_page_height(in.get_image()); int page_height = vips_image_get_page_height(in.get_image());

View file

@ -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);