From 9fd9464cc5255256f71f34e6b5e2060cfca29edf Mon Sep 17 00:00:00 2001 From: TheEssem Date: Sat, 22 May 2021 22:24:34 -0500 Subject: [PATCH] Try a method for large meme text scaling --- natives/meme.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/natives/meme.cc b/natives/meme.cc index edd68ca..eea965b 100644 --- a/natives/meme.cc +++ b/natives/meme.cc @@ -29,6 +29,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) { coalesceImages(&coalesced, frames.begin(), frames.end()); int width = coalesced.front().columns(); + int dividedWidth = width / 1000; top_text.size(Geometry(to_string(width))); top_text.backgroundColor("none"); @@ -41,6 +42,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) { top_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon"); top_text_fill.backgroundColor("black"); top_text_fill.alphaChannel(Magick::ShapeAlphaChannel); + if (dividedWidth > 1) top_text_fill.morphology(Magick::DilateMorphology, "Octagon", dividedWidth); top_text.composite(top_text_fill, Magick::CenterGravity, Magick::DstOverCompositeOp); @@ -56,6 +58,7 @@ Napi::Value Meme(const Napi::CallbackInfo &info) { bottom_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon"); bottom_text_fill.backgroundColor("black"); bottom_text_fill.alphaChannel(Magick::ShapeAlphaChannel); + if (dividedWidth > 1) bottom_text_fill.morphology(Magick::DilateMorphology, "Octagon", dividedWidth); bottom_text.composite(bottom_text_fill, Magick::CenterGravity, Magick::DstOverCompositeOp); }