Begin the purge
This commit is contained in:
parent
1a86730489
commit
4ac90bc761
17 changed files with 0 additions and 337 deletions
|
@ -1,7 +1,5 @@
|
|||
#include <napi.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <vips/vips8>
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include "blur.h"
|
||||
#include "colors.h"
|
||||
#include "caption.h"
|
||||
|
@ -23,7 +22,6 @@
|
|||
#include "motivate.h"
|
||||
#include "reddit.h"
|
||||
#include "resize.h"
|
||||
#include "retro.h"
|
||||
#include "reverse.h"
|
||||
#include "scott.h"
|
||||
#include "snapchat.h"
|
||||
|
@ -34,7 +32,6 @@
|
|||
#include "uncaption.h"
|
||||
#include "wall.h"
|
||||
#include "watermark.h"
|
||||
#include "wdt.h"
|
||||
#include "whisper.h"
|
||||
#include "zamn.h"
|
||||
|
||||
|
@ -72,7 +69,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|||
exports.Set(Napi::String::New(env, "motivate"), Napi::Function::New(env, Motivate));
|
||||
exports.Set(Napi::String::New(env, "reddit"), Napi::Function::New(env, Reddit));
|
||||
exports.Set(Napi::String::New(env, "resize"), Napi::Function::New(env, Resize));
|
||||
exports.Set(Napi::String::New(env, "retro"), Napi::Function::New(env, Retro));
|
||||
exports.Set(Napi::String::New(env, "reverse"), Napi::Function::New(env, Reverse));
|
||||
exports.Set(Napi::String::New(env, "scott"), Napi::Function::New(env, Scott));
|
||||
exports.Set(Napi::String::New(env, "snapchat"), Napi::Function::New(env, Snapchat));
|
||||
|
@ -84,7 +80,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|||
exports.Set(Napi::String::New(env, "uncaption"), Napi::Function::New(env, Uncaption));
|
||||
exports.Set(Napi::String::New(env, "wall"), Napi::Function::New(env, Wall));
|
||||
exports.Set(Napi::String::New(env, "watermark"), Napi::Function::New(env, Watermark));
|
||||
exports.Set(Napi::String::New(env, "wdt"), Napi::Function::New(env, Wdt));
|
||||
exports.Set(Napi::String::New(env, "whisper"), Napi::Function::New(env, Whisper));
|
||||
exports.Set(Napi::String::New(env, "zamn"), Napi::Function::New(env, Zamn));
|
||||
return exports;
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
#include <Magick++.h>
|
||||
#include <napi.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
Napi::Value Retro(const Napi::CallbackInfo &info) {
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
try {
|
||||
Napi::Object obj = info[0].As<Napi::Object>();
|
||||
string line1 = obj.Get("line1").As<Napi::String>().Utf8Value();
|
||||
string line2 = obj.Get("line2").As<Napi::String>().Utf8Value();
|
||||
string line3 = obj.Get("line3").As<Napi::String>().Utf8Value();
|
||||
string basePath = obj.Get("basePath").As<Napi::String>().Utf8Value();
|
||||
|
||||
Blob blob;
|
||||
|
||||
Image image;
|
||||
Image line1_text;
|
||||
Image line2_text;
|
||||
Image line3_text;
|
||||
|
||||
image.read(basePath + "assets/images/retro.png");
|
||||
|
||||
line2_text.backgroundColor("none");
|
||||
line2_text.fontPointsize(128);
|
||||
line2_text.textGravity(Magick::CenterGravity);
|
||||
line2_text.font("Comic Sans MS");
|
||||
line2_text.read("pango:<span foreground='white'>" +
|
||||
(line2 == "" ? line1 : line2) + "</span>");
|
||||
line2_text.extent(Geometry("1260x859+0+0"), Magick::CenterGravity);
|
||||
Image line2_text_fill = line2_text;
|
||||
line2_text_fill.channel(Magick::AlphaChannel);
|
||||
line2_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon:10");
|
||||
line2_text_fill.backgroundColor("gray");
|
||||
line2_text_fill.alphaChannel(Magick::ShapeAlphaChannel);
|
||||
line2_text.composite(line2_text_fill, Magick::CenterGravity,
|
||||
Magick::DstOverCompositeOp);
|
||||
image.composite(line2_text, Geometry("+0-100"), Magick::OverCompositeOp);
|
||||
|
||||
if (line2 != "") {
|
||||
line1_text.backgroundColor("none");
|
||||
line1_text.fontPointsize(64);
|
||||
line1_text.textGravity(Magick::CenterGravity);
|
||||
line1_text.font("Comic Sans MS");
|
||||
line1_text.read("pango:<span foreground='white'>" + line1 + "</span>");
|
||||
line1_text.extent(Geometry("1260x859+0+0"), Magick::CenterGravity);
|
||||
Image line1_text_fill = line1_text;
|
||||
line1_text_fill.channel(Magick::AlphaChannel);
|
||||
line1_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon:10");
|
||||
line1_text_fill.backgroundColor("gray");
|
||||
line1_text_fill.alphaChannel(Magick::ShapeAlphaChannel);
|
||||
line1_text.composite(line1_text_fill, Magick::CenterGravity,
|
||||
Magick::DstOverCompositeOp);
|
||||
image.composite(line1_text, Geometry("+0-250"), Magick::OverCompositeOp);
|
||||
}
|
||||
|
||||
if (line3 != "") {
|
||||
line3_text.backgroundColor("none");
|
||||
line3_text.fontPointsize(64);
|
||||
line3_text.textGravity(Magick::CenterGravity);
|
||||
line3_text.font("Comic Sans MS");
|
||||
line3_text.read("pango:<span foreground='white'>" + line3 + "</span>");
|
||||
line3_text.extent(Geometry("1260x859+0+0"), Magick::CenterGravity);
|
||||
Image line3_text_fill = line3_text;
|
||||
line3_text_fill.channel(Magick::AlphaChannel);
|
||||
line3_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon:10");
|
||||
line3_text_fill.backgroundColor("gray");
|
||||
line3_text_fill.alphaChannel(Magick::ShapeAlphaChannel);
|
||||
line3_text.composite(line3_text_fill, Magick::CenterGravity,
|
||||
Magick::DstOverCompositeOp);
|
||||
image.composite(line3_text, Geometry("+0+50"), Magick::OverCompositeOp);
|
||||
}
|
||||
|
||||
image.magick("PNG");
|
||||
image.write(&blob);
|
||||
|
||||
Napi::Object result = Napi::Object::New(env);
|
||||
result.Set("data", Napi::Buffer<char>::Copy(env, (char *)blob.data(),
|
||||
blob.length()));
|
||||
result.Set("type", "png");
|
||||
return result;
|
||||
} catch (std::exception const &err) {
|
||||
throw Napi::Error::New(env, err.what());
|
||||
} catch (...) {
|
||||
throw Napi::Error::New(env, "Unknown error");
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Retro(const Napi::CallbackInfo& info);
|
|
@ -1,7 +1,5 @@
|
|||
#include <napi.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <vips/vips8>
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
#include <Magick++.h>
|
||||
#include <napi.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
Napi::Value Wdt(const Napi::CallbackInfo &info) {
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
try {
|
||||
Napi::Object obj = info[0].As<Napi::Object>();
|
||||
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
|
||||
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
||||
string basePath = obj.Get("basePath").As<Napi::String>().Utf8Value();
|
||||
|
||||
Blob blob;
|
||||
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> mid;
|
||||
Image watermark;
|
||||
try {
|
||||
readImages(&frames, Blob(data.Data(), data.Length()));
|
||||
} catch (Magick::WarningCoder &warning) {
|
||||
cerr << "Coder Warning: " << warning.what() << endl;
|
||||
} catch (Magick::Warning &warning) {
|
||||
cerr << "Warning: " << warning.what() << endl;
|
||||
}
|
||||
watermark.read(basePath + "assets/images/whodidthis.png");
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
Image watermark_new = watermark;
|
||||
image.scale(Geometry("374x374>"));
|
||||
watermark_new.composite(image, Magick::CenterGravity,
|
||||
Magick::OverCompositeOp);
|
||||
watermark_new.magick(type);
|
||||
watermark_new.animationDelay(image.animationDelay());
|
||||
mid.push_back(watermark_new);
|
||||
}
|
||||
|
||||
optimizeTransparency(mid.begin(), mid.end());
|
||||
|
||||
if (type == "gif") {
|
||||
for (Image &image : mid) {
|
||||
image.quantizeDitherMethod(FloydSteinbergDitherMethod);
|
||||
image.quantize();
|
||||
}
|
||||
}
|
||||
|
||||
writeImages(mid.begin(), mid.end(), &blob);
|
||||
|
||||
Napi::Object result = Napi::Object::New(env);
|
||||
result.Set("data", Napi::Buffer<char>::Copy(env, (char *)blob.data(),
|
||||
blob.length()));
|
||||
result.Set("type", type);
|
||||
return result;
|
||||
} catch (std::exception const &err) {
|
||||
throw Napi::Error::New(env, err.what());
|
||||
} catch (...) {
|
||||
throw Napi::Error::New(env, "Unknown error");
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Wdt(const Napi::CallbackInfo& info);
|
Loading…
Add table
Add a link
Reference in a new issue