initial commit
This commit is contained in:
commit
19b0960fe4
4 changed files with 39 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
text.pango
|
||||
label.jpg
|
2
Dockerfile
Normal file
2
Dockerfile
Normal file
|
@ -0,0 +1,2 @@
|
|||
FROM docker.io/alpine:latest
|
||||
RUN apk add imagemagick imagemagick-jpeg imagemagick-pango font-fira-code-nerd
|
34
main.sh
Executable file
34
main.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env sh
|
||||
# takes two optional arguments
|
||||
# -t path to pango formated text file
|
||||
# https://usage.imagemagick.org/text/#pango
|
||||
# this can be overwritten with the text inside a env var named
|
||||
# IMAGE_TEXT
|
||||
#
|
||||
# -p is a path to write the jpg to
|
||||
# alternativly you can write the path into PICTURE_PATH
|
||||
set -E -o pipefail
|
||||
#shopt -s failglob
|
||||
export LC_ALL='C.UTF8'
|
||||
|
||||
P_PATH="./label.jpg"
|
||||
I_TEXT="$(cat ./text.pango)"
|
||||
|
||||
P_PATH="${PICTURE_PATH:-$P_PATH}"
|
||||
I_TEXT="${IMAGE_TEXT:-$I_TEXT}"
|
||||
|
||||
|
||||
while getopts "p:t:" opt
|
||||
do
|
||||
case "$opt" in
|
||||
p) P_PATH="$OPTARG";;
|
||||
t) I_TEXT="$OPTARG";;
|
||||
esac
|
||||
done
|
||||
|
||||
magick \
|
||||
-background '#FFFFFF' \
|
||||
-fill '#000000' \
|
||||
-font 'FiraCode Nerd Font' \
|
||||
-pointsize 72 pango:"$I_TEXT" \
|
||||
"$P_PATH"
|
1
text.pango.example
Normal file
1
text.pango.example
Normal file
|
@ -0,0 +1 @@
|
|||
<i>Pretty example text with Pango</i>
|
Loading…
Add table
Reference in a new issue