Change default searx URL, update packages

This commit is contained in:
Essem 2022-06-22 11:00:31 -05:00
parent ef97602d32
commit ff84306637
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
24 changed files with 119 additions and 104 deletions

View file

@ -25,7 +25,7 @@ Napi::Value Caption(const Napi::CallbackInfo &info) {
int width = in.width();
int size = width / 10;
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
int textWidth = width - ((width / 25) * 2);
string font_string = (font == "roboto" ? "Roboto Condensed" : font) + " " +
@ -47,7 +47,7 @@ Napi::Value Caption(const Napi::CallbackInfo &info) {
VImage::option()->set("extend", "white"));
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
VImage frame = captionImage.join(

View file

@ -27,7 +27,7 @@ Napi::Value CaptionTwo(const Napi::CallbackInfo &info) {
int width = in.width();
int size = width / 13;
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
int textWidth = width - ((width / 25) * 2);
string font_string =
@ -48,7 +48,7 @@ Napi::Value CaptionTwo(const Napi::CallbackInfo &info) {
VImage::option()->set("extend", "white"));
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
VImage frame =

View file

@ -22,11 +22,11 @@ Napi::Value Crop(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
vector<VImage> img;
int finalHeight = 0;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
int frameWidth = img_frame.width();

View file

@ -27,14 +27,14 @@ Napi::Value Deepfry(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int totalHeight = in.height();
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
VImage fried = (in * 1.3 - (255.0 * 1.3 - 255.0)) * 1.5;
VImage final;
if (totalHeight > 65500 && type == "gif") {
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame = in.crop(0, i * pageHeight, width, pageHeight);
void *jpgBuf;
size_t jpgLength;

View file

@ -25,7 +25,7 @@ Napi::Value Flag(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
string assetPath = basePath + overlay;
VImage overlayInput = VImage::new_from_file(assetPath.c_str());
@ -41,7 +41,7 @@ Napi::Value Flag(const Napi::CallbackInfo &info) {
}
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
VImage composited =

View file

@ -30,8 +30,8 @@ Napi::Value Flip(const Napi::CallbackInfo &info) {
// libvips gif handling is both a blessing and a curse
vector<VImage> img;
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
for (int i = 0; i < n_pages; i++) {
int nPages = vips_image_get_n_pages(in.get_image());
for (int i = 0; i < nPages; i++) {
VImage img_frame = in.crop(0, i * pageHeight, in.width(), pageHeight);
VImage flipped = img_frame.flip(VIPS_DIRECTION_VERTICAL);
img.push_back(flipped);

View file

@ -59,8 +59,8 @@ Napi::Value Freeze(const Napi::CallbackInfo &info) {
if (!in.has_alpha()) in = in.bandjoin(255);
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int framePos = clamp(frame, 0, (int)n_pages);
int nPages = vips_image_get_n_pages(in.get_image());
int framePos = clamp(frame, 0, (int)nPages);
VImage out = in.crop(0, 0, in.width(), pageHeight * (framePos + 1));
out.set(VIPS_META_PAGE_HEIGHT, pageHeight);
out.set("loop", loop ? 0 : 1);

View file

@ -27,10 +27,10 @@ Napi::Value Gamexplain(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
VImage resized = img_frame

View file

@ -26,7 +26,7 @@ Napi::Value Globe(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = type == "gif" ? vips_image_get_n_pages(in.get_image()) : 30;
int nPages = type == "gif" ? vips_image_get_n_pages(in.get_image()) : 30;
double size = min(width, pageHeight);
@ -52,14 +52,14 @@ Napi::Value Globe(const Napi::CallbackInfo &info) {
size;
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
VImage resized = img_frame.resize(
size / (double)width,
VImage::option()->set("vscale", size / (double)pageHeight));
VImage rolled = img_frame.wrap(
VImage::option()->set("x", width * i / n_pages)->set("y", 0));
VImage::option()->set("x", width * i / nPages)->set("y", 0));
VImage extracted = rolled.extract_band(0, VImage::option()->set("n", 3));
VImage mapped = extracted.mapim(distort);
VImage composited = mapped * diffuse + specular;

View file

@ -30,13 +30,13 @@ Napi::Value Jpeg(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int totalHeight = in.height();
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
VImage final;
if (totalHeight > 65500) {
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame = in.crop(0, i * pageHeight, width, pageHeight);
void *jpgBuf;
size_t jpgLength;

View file

@ -26,7 +26,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
int size = width / 9;
int dividedWidth = width / 1000;
int rad = 1;
@ -104,7 +104,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) {
}
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
if (top != "") {

View file

@ -33,9 +33,9 @@ Napi::Value Mirror(const Napi::CallbackInfo &info) {
// once again, libvips gif handling is both a blessing and a curse
vector<VImage> img;
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
bool isOdd = pageHeight % 2;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
int x = (i * pageHeight) + (first ? 0 : (pageHeight / 2));
VImage cropped = in.crop(0, x, in.width(), pageHeight / 2);
VImage flipped = cropped.flip(VIPS_DIRECTION_VERTICAL);

View file

@ -27,7 +27,7 @@ Napi::Value Motivate(const Napi::CallbackInfo &info) {
int width = in.width();
int size = width / 5;
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
int textWidth = width - ((width / 25) * 2);
string font_string = font == "roboto" ? "Roboto Condensed" : font;
@ -59,7 +59,7 @@ Napi::Value Motivate(const Napi::CallbackInfo &info) {
vector<VImage> img;
int height;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;

View file

@ -27,7 +27,7 @@ Napi::Value Reddit(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
string captionText = "<span foreground=\"white\">" + text + "</span>";
@ -45,7 +45,7 @@ Napi::Value Reddit(const Napi::CallbackInfo &info) {
composited.resize((double)width / (double)composited.width());
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
VImage frame = img_frame.join(watermark, VIPS_DIRECTION_VERTICAL,

View file

@ -28,6 +28,7 @@ Napi::Value Resize(const Napi::CallbackInfo &info) {
VImage out;
int width = in.width();
int totalHeight = in.height();
int pageHeight = vips_image_get_page_height(in.get_image());
int finalHeight;
@ -40,8 +41,12 @@ Napi::Value Resize(const Napi::CallbackInfo &info) {
out = in.resize(9.5, VImage::option()->set("vscale", 0.5));
finalHeight = pageHeight / 2;
} else {
out = in.resize(0.1).resize(
10, VImage::option()->set("kernel", VIPS_KERNEL_NEAREST));
VImage small = in.resize(0.1);
out =
small.resize((double)width / small.width(),
VImage::option()
->set("vscale", (double)totalHeight / small.height())
->set("kernel", VIPS_KERNEL_NEAREST));
finalHeight = pageHeight;
}
out.set(VIPS_META_PAGE_HEIGHT, finalHeight);

View file

@ -22,11 +22,11 @@ Napi::Value Reverse(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
vector<VImage> split;
// todo: find a better way of getting individual frames (or at least getting the frames in reverse order)
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame = in.crop(0, i * pageHeight, width, pageHeight);
split.push_back(img_frame);
}

View file

@ -26,7 +26,7 @@ Napi::Value Snapchat(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
int size = width / 20;
int textWidth = width - ((width / 25) * 2);
@ -52,7 +52,7 @@ Napi::Value Snapchat(const Napi::CallbackInfo &info) {
->set("background", (vector<double>){0, 0, 0, 178}));
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
img_frame = img_frame.composite2(

View file

@ -23,10 +23,10 @@ void vipsRemove(Napi::Env *env, Napi::Object *result, Napi::Buffer<char> data,
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
vector<VImage> img;
for (int i = 0; i < n_pages; i += speed) {
for (int i = 0; i < nPages; i += speed) {
VImage img_frame = in.crop(0, i * pageHeight, width, pageHeight);
img.push_back(img_frame);
}

View file

@ -26,7 +26,7 @@ Napi::Value Uncaption(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
VImage first =
in.crop(0, 0, 3, pageHeight).colourspace(VIPS_INTERPRETATION_B_W) >
@ -40,7 +40,7 @@ Napi::Value Uncaption(const Napi::CallbackInfo &info) {
newHeight = pageHeight;
top = 0;
}
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
in.crop(0, (i * pageHeight) + top, width, newHeight);
img.push_back(img_frame);

View file

@ -41,7 +41,7 @@ Napi::Value Watermark(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
if (resize && append) {
watermark = watermark.resize((double)width / (double)watermark.width());
@ -89,7 +89,7 @@ Napi::Value Watermark(const Napi::CallbackInfo &info) {
VImage frameAlpha;
VImage bg;
VImage frame;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
if (append) {

View file

@ -24,7 +24,7 @@ Napi::Value Whisper(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
int size = width / 6;
int dividedWidth = width / 175;
int rad = 1;
@ -64,7 +64,7 @@ Napi::Value Whisper(const Napi::CallbackInfo &info) {
VImage textImg = outline.composite2(textIn, VIPS_BLEND_MODE_OVER);
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
img_frame = img_frame.composite2(

View file

@ -24,13 +24,13 @@ Napi::Value Zamn(const Napi::CallbackInfo &info) {
int width = in.width();
int pageHeight = vips_image_get_page_height(in.get_image());
int n_pages = vips_image_get_n_pages(in.get_image());
int nPages = vips_image_get_n_pages(in.get_image());
string assetPath = basePath + "assets/images/zamn.png";
VImage tmpl = VImage::new_from_file(assetPath.c_str());
vector<VImage> img;
for (int i = 0; i < n_pages; i++) {
for (int i = 0; i < nPages; i++) {
VImage img_frame =
type == "gif" ? in.crop(0, i * pageHeight, width, pageHeight) : in;
VImage composited = tmpl.insert(