use 'magick' to execute imagemagick commands

This commit is contained in:
Christopher Monsanto 2020-09-13 22:22:43 -04:00
parent 12ba3cbf1f
commit 7b3a9376bc
5 changed files with 8 additions and 7 deletions

View File

@ -8,7 +8,7 @@ ROOTDIR = tup.getcwd()
function pad(opts)
return rep{
"convert ${input} -background transparent -gravity center -extent ${w}x${h} ${output}",
"magick convert ${input} -background transparent -gravity center -extent ${w}x${h} ${output}",
input = opts.input or "%f",
output = opts.output or "%o",
w = opts.w,
@ -18,7 +18,7 @@ end
function trimimg(opts) -- Can't just be trim because of the string function...
return rep{
"convert ${input} -trim ${output}",
"magick convert ${input} -trim ${output}",
input = opts.input or "%f",
output = opts.output or "%o",
}

View File

@ -2,4 +2,4 @@
# Smogdex Facebook social images
convert $1'[0]' -trim -resize 150x150 -background white -gravity center -extent 198x198 -bordercolor black -border 1 $2
magick convert $1'[0]' -trim -resize 150x150 -background white -gravity center -extent 198x198 -bordercolor black -border 1 $2

View File

@ -21,7 +21,8 @@ for (let i = 0; i < sheet.entries.length; i++) {
}
}
cp.execFileSync("montage", [
cp.execFileSync("magick", [
"montage",
...sheet.entries,
"-background", "transparent",
"-geometry", `${sheet.width}x${sheet.height}>`,

View File

@ -2,7 +2,7 @@
import cp from 'child_process';
export function getDims(input : string) {
const info = cp.execFileSync('convert', [input, '-format', "%w+%h+%@", 'info:'],
const info = cp.execFileSync('magick', ['convert', input, '-format', "%w+%h+%@", 'info:'],
{encoding:'utf8'});
const [imageWidth, imageHeight, width, height, left, top] =
@ -22,7 +22,7 @@ export function getDims(input : string) {
}
export function crop(input : string, {width, height, left, top} : {width : number, height: number, left: number, top: number}, output : string) {
cp.execFileSync('convert', [input, '+repage', '-crop', `${width}x${height}+${left}+${top}`, output]);
cp.execFileSync('magick', ['convert', input, '+repage', '-crop', `${width}x${height}+${left}+${top}`, output]);
}
// Trim, preserving displacement from center

View File

@ -2,4 +2,4 @@
# Smogdex Twitter social images
convert $1'[0]' -trim -resize 115x115 -background white -gravity center -extent 120x120 $2
magick convert $1'[0]' -trim -resize 115x115 -background white -gravity center -extent 120x120 $2