Added quality option to jpeg, adjusted CMakeLists, more tweaks
This commit is contained in:
parent
76fe5b6aa6
commit
715ed3bb7b
5 changed files with 26 additions and 14 deletions
|
@ -37,7 +37,7 @@ Napi::Value Caption(const Napi::CallbackInfo &info) {
|
|||
Image caption_image(Geometry(query), Color("white"));
|
||||
caption_image.fillColor("black");
|
||||
caption_image.alpha(true);
|
||||
caption_image.fontPointsize(width / 13);
|
||||
caption_image.fontPointsize((double)width / 13);
|
||||
caption_image.textGravity(Magick::CenterGravity);
|
||||
caption_image.read("pango:<span font_family=\"" +
|
||||
(font == "roboto" ? "Roboto Condensed" : font) +
|
||||
|
|
|
@ -13,6 +13,8 @@ Napi::Value Jpeg(const Napi::CallbackInfo &info) {
|
|||
try {
|
||||
Napi::Object obj = info[0].As<Napi::Object>();
|
||||
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
|
||||
int quality =
|
||||
obj.Has("quality") ? obj.Get("quality").As<Napi::Number>().Int32Value() : 0;
|
||||
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
||||
int delay =
|
||||
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
|
||||
|
@ -36,7 +38,7 @@ Napi::Value Jpeg(const Napi::CallbackInfo &info) {
|
|||
|
||||
for (Image &image : coalesced) {
|
||||
Blob temp;
|
||||
image.quality(1);
|
||||
image.quality(quality);
|
||||
image.magick("JPEG");
|
||||
image.write(&temp);
|
||||
Image newImage(temp);
|
||||
|
@ -75,4 +77,4 @@ Napi::Value Jpeg(const Napi::CallbackInfo &info) {
|
|||
} catch (...) {
|
||||
throw Napi::Error::New(env, "Unknown error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue