Skip to content
Snippets Groups Projects
Commit fe58c707 authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

"VACOM"

parent d6e82d14
No related branches found
No related tags found
No related merge requests found
VACOM/body.png

410 KiB

#!/bin/bash
#
# Rolf Niepraschk <Rolf.Niepraschk@ptb.de>, 2017-06-16
#
# Erzeugt aus einem leeren Messgeräte-Bild und neun 7-Segment-Bildern
# neue Messgeräte-Bilder
#
# Parameter1 = Anzahl der erzeugten Bilddateien
#
# Parameter2 = Anzahl der Einzelziffern
MAIN="VACOM" # device name
IMAGE_DIR=./images
MAX_DIGITS=5 # do not edit!
MAX_FILES=10 # do not edit!
NUMBER_OF_DIGITS=$MAX_DIGITS
SHOW_EXP=true
if [ -n "$1" ]; then
MAX_FILES=$1
fi
if (( $NUMBER_OF_DIGITS > $MAX_DIGITS )); then
NUMBER_OF_DIGITS=$MAX_DIGITS
else
if (( $NUMBER_OF_DIGITS < 1 )); then
NUMBER_OF_DIGITS=1
fi
fi
rm -rf "$IMAGE_DIR"
mkdir -p "$IMAGE_DIR"
dotFile='dot.png'
edotFile='edot.png'
emptyCanvas='xc:transparent'
#---------------------
dotFile='dot.png'
plusFile='plus.png'
minusFile='minus.png'
emptyCanvas='xc:transparent'
digitFile[0]='digit-0.png'
digitFile[1]='digit-1.png'
digitFile[2]='digit-2.png'
digitFile[3]='digit-3.png'
digitFile[4]='digit-4.png'
digitFile[5]='digit-5.png'
digitFile[6]='digit-6.png'
digitFile[7]='digit-7.png'
digitFile[8]='digit-8.png'
digitFile[9]='digit-9.png'
edigitFile[0]='edigit-0.png'
edigitFile[1]='edigit-1.png'
edigitFile[2]='edigit-2.png'
edigitFile[3]='edigit-3.png'
edigitFile[4]='edigit-4.png'
edigitFile[5]='edigit-5.png'
edigitFile[6]='edigit-6.png'
edigitFile[7]='edigit-7.png'
edigitFile[8]='edigit-8.png'
edigitFile[9]='edigit-9.png'
digitPos[1]='+146+195'
digitPos[2]='+198+195'
digitPos[3]='+250+195'
digitPos[4]='+318+195'
digitPos[5]='+351+195'
dotPos[1]=${digitPos[1]}
dotPos[2]=${digitPos[2]}
dotPos[3]=${digitPos[3]}
dotPos[4]=${digitPos[4]}
dotPos[5]=${digitPos[5]}
for ((FNb=1; FNb<=MAX_FILES; FNb++)); do
value=""
DPR=$((RANDOM % ($NUMBER_OF_DIGITS + 1))) # random dot position (0..$NUMBER_OF_DIGITS)
for (( i=1; i<=$MAX_DIGITS; i++ )); do
if (( $i == 4 )); then
value+="-"
fi
R=$((RANDOM % 10)) # random digit number (0..9='0'..'9')
value+="${R}"
if (( $i <= 3 )); then # mantissa
eval DIGIT$i=${digitFile[R]}
if [ $DPR == $i ]; then
eval DOT$i="$dotFile"
value+="."
else
eval DOT$i=$emptyCanvas;
fi
else # exponent
eval DIGIT$i=${edigitFile[R]}
if [ $DPR == $i ]; then
eval DOT$i="$edotFile"
value+="."
else
eval DOT$i=$emptyCanvas;
fi
fi
done # NUMBER_OF_DIGITS
fname="$IMAGE_DIR/$MAIN@$value@.png"
echo -e "$FNb:\t$fname"
convert body.png \
$DIGIT1 -geometry ${digitPos[1]} -composite \
$DOT1 -geometry ${dotPos[1]} -composite \
$DIGIT2 -geometry ${digitPos[2]} -composite \
$DOT2 -geometry ${dotPos[2]} -composite \
$DIGIT3 -geometry ${digitPos[3]} -composite \
$DOT3 -geometry ${dotPos[3]} -composite \
$DIGIT4 -geometry ${digitPos[4]} -composite \
$DOT4 -geometry ${dotPos[4]} -composite \
$DIGIT5 -geometry ${digitPos[5]} -composite \
$DOT5 -geometry ${dotPos[5]} -composite \
$fname
exiv2 -M"set Exif.Image.ImageDescription value=$value" $fname
done # MAX_FILES
exit
-----------------------------------------------------------------------
Auslesen der Exif-Daten:
exiv2 -g Exif.Image.ImageDescription -P v ./images/ADIXEN@???@.png
--> value=???
VACOM/digit-0.png

3.35 KiB

VACOM/digit-1.png

1.63 KiB

VACOM/digit-2.png

2.89 KiB

VACOM/digit-3.png

2.97 KiB

VACOM/digit-4.png

1.93 KiB

VACOM/digit-5.png

2.81 KiB

VACOM/digit-6.png

3.26 KiB

VACOM/digit-7.png

1.97 KiB

VACOM/digit-8.png

3.7 KiB

VACOM/digit-9.png

2.93 KiB

VACOM/dot.png

413 B

VACOM/edigit-0.png

1.67 KiB

VACOM/edigit-1.png

917 B

VACOM/edigit-2.png

1.56 KiB

VACOM/edigit-3.png

1.46 KiB

VACOM/edigit-4.png

1.33 KiB

VACOM/edigit-5.png

1.54 KiB

VACOM/edigit-6.png

1.64 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment