#!/bin/bash function umtopix() { echo $(( $1 * 10 / 254 )) } function scalenum() { echo $(( $1 * $W / `umtopix 25800` )) } #diameter in micrometers W=`umtopix 20000` W=`umtopix 20000` H=$W #output file name COINNAME=coin-fukitol # set to 0 to disable the circle mark #CIRCLE=1 #font size TXTSZ=`scalenum 150` #width of text bar, characterizes spacing from the coin edge TXTBAR=`scalenum 300` #text content TXT="FUKITOL\n500 mg" IMAGE=bigbrother-silhouette.png IMAGESIZEX=`scalenum 720` IMAGEPOSX=0 IMAGEPOSY=60 IMAGESIZE=${IMAGESIZEX}x${IMAGESIZEX} IMAGEPOS=+`scalenum $IMAGEPOSX`+`scalenum IMAGEPOSY` # 300 -> 0.77 # 250 -> 0.80 # 200 -> 0.84 FONT="Helvetica-Bold" KERN=6 TMPF=tmp.png CIRCLECOL=yellow convert -size ${W}x${H} xc:$BACKGROUND \ -colorspace Gray \ -gravity center \ -fill black \ -strokewidth 10 \ -gravity center \ -font "$FONT" -pointsize $TXTSZ -kerning $KERN -strokewidth 4 -fill black -stroke none -interline-spacing 50 \ -annotate +0+0 "$TXT" \ -gravity center \ -draw "fill none stroke $CIRCLECOL circle $(( $W / 2 )),$(( $H / 2 )),0,$(( $H / 2 )) " \ -density 1000 -units PixelsPerInch \ $COINNAME.png convert $COINNAME.png -dither none -colors 2 -monochrome $COINNAME.bmp