ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Henning Hraban Ramm <texml@fiee.net>
Subject: Re: Use MetaPost to distort images?
Date: Sun, 5 Sep 2021 09:40:38 +0200	[thread overview]
Message-ID: <FCD06229-1EF8-4781-86C5-0DEA54CD0AF3@fiee.net> (raw)
In-Reply-To: <05b7cfc3-464d-edb2-841e-f03b61b0dbe6@xs4all.nl>



> Am 04.09.2021 um 19:06 schrieb Hans Hagen <j.hagen@xs4all.nl>:
> 
> On 9/4/2021 2:18 PM, Henning Hraban Ramm via ntg-context wrote:
> 
>> I guess it’s on me to write a wiki page about GM.
> 
> you can then also add some comparison with im (i.e. what does it offer more than gm)

Oh no...

IM and GM have a history, and I don’t want to get involved.

GM accuses IM of security issues, feature and dependency bloat, bad code quality, inefficiency, frequent API changes, license changes and whatnot.

OTOH IM offers much more features (e.g. the geometric transformations I inquired about), and you can find lots of interesting examples (including the scripts Bruce mentioned). I couldn’t find another CLI tool that can do most of these things, at least not with much more programming.


Dependencies according to MacPorts:

Full Name: GraphicsMagick @1.3.36_1+q8
Library Dependencies: libxml2, bzip2, xz, zlib, libpng, tiff, freetype, libiconv, libtool, lcms2, jasper, libjpeg-turbo, webp

Full Name: ImageMagick @6.9.11-60_1+x11
Library Dependencies: bzip2, djvulibre, xz, jbigkit, libjpeg-turbo, lcms2, libpng, libraw, tiff, webp, zlib, fftw-3, freetype, fontconfig, ghostscript, libiconv, libtool, openjpeg, openexr, expat, libxml2, libheif, pkgconfig, xorg-libX11, xorg-libXext, xorg-libXt
Runtime Dependencies: urw-fonts


It’s probably not wise to run IM in a web server process for security and efficiency reasons, but if I run it only on my own computer there shouldn’t be a problem.


BTW, here’s my script:


#!/bin/bash
#INPUT=$1

OUTPUT=${INPUT/.JPG/.png}
OUTPUT=${OUTPUT/.jpg/.png}
OUTPUT=${OUTPUT/in\//out\/}

# random rotation ±1.5˚
ROTATION=`jot -r 1 -1.5 1.5`
echo $OUTPUT ${ROTATION}˚

# downscale, add a white border and a shadow, rotate, move down, add a piece of tape (tesa1.png), grayscale
convert "$INPUT" \
-auto-orient \
-resize 800x800 \
-bordercolor white -border 10 \
\( +clone -background black -shadow 80x3+2+2 \) +swap \
-background transparent \
-layers merge \
-rotate ${ROTATION} \
+repage  \
-gravity north \
-splice 0x10 \
\( tesa1.png -resize 200x50! \) -compose Multiply -composite \
-colorspace Gray \
"$OUTPUT"


Here are some results:
https://sedna.fiee.net/d/2c3218730f8341aab1fa/


Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2021-09-05  7:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 10:28 Henning Hraban Ramm via ntg-context
2021-09-03 16:24 ` Hans Hagen via ntg-context
2021-09-04 12:18   ` Henning Hraban Ramm via ntg-context
2021-09-04 17:06     ` Hans Hagen via ntg-context
2021-09-05  7:40       ` Henning Hraban Ramm via ntg-context [this message]
2021-09-05  8:10         ` Hans Hagen via ntg-context
2021-09-05  9:34           ` Henning Hraban Ramm via ntg-context
2021-09-06  2:13             ` Aditya Mahajan via ntg-context
2021-09-06  8:42               ` Henning Hraban Ramm via ntg-context
2021-09-05  8:46         ` Hans Hagen via ntg-context
2021-09-03 22:16 ` Bruce Horrocks via ntg-context
2021-09-04 11:59   ` Henning Hraban Ramm via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FCD06229-1EF8-4781-86C5-0DEA54CD0AF3@fiee.net \
    --to=ntg-context@ntg.nl \
    --cc=texml@fiee.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).