-
Notifications
You must be signed in to change notification settings - Fork 17
/
convert.sh
executable file
·15 lines (14 loc) · 992 Bytes
/
convert.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
if [[ $1 == "bash" ]]; then
docker run -i -t --rm -v `pwd`:/data --entrypoint /bin/bash dxf2png:latest
else
# $1 dxf file path relative to current directory
# $2 output file path relative to current directory. File exetension controls file type to convert (.png, .bmp, .jpg, .svg are supported)
# $3 (optional) output file background color: black, white, transparent
# $4 (optional) output file max width
# $5 (optional) output file max height
# $6 (optional) layer filter, all layers are included if not specified.
# +layer0,layer1,layer2 to include only layer0 to layer 2, i.e whitelisting
# -layer0,layer1,layer2 to include everythign except layer0 to layer2, i.e blacklisting
docker run -i -t --rm -v `pwd`:/data -u=$UID:$(id -g $USER) dxf2png:latest bash -c "set -e; set -x;cp /data/$1 /tmp/src.dxf; enca -L chinese -x UTF-8 /tmp/src.dxf; xvfb-run -a /dxf2png/dxf2png /tmp/src.dxf /data/$2 $3 $4 $5 $6"
fi