Skip to content

Instantly share code, notes, and snippets.

@gghatano
Created November 7, 2019 04:06
Show Gist options
  • Save gghatano/33ecbc05a942dfd3a8d57bfe07eb963e to your computer and use it in GitHub Desktop.
Save gghatano/33ecbc05a942dfd3a8d57bfe07eb963e to your computer and use it in GitHub Desktop.
chromeでスクショした地図画像をいい感じにリサイズして切り出したり変換したりした
dir=$(dirname $0)
if [ -e "$dir/converted_images" ] ; then
echo "output directory exists"
else
mkdir $dir/converted_images
fi
ls *.png | grep "_C" |
# head -n 2 |
while read line
do
echo $line
filename=$(echo $line | awk -F_ -v OFS="_" '{print $9,$10,$11,$12,$13}')
baseFilename=$(basename $filename .csv.html.png)
cp $line ${baseFilename}.png
echo "basefilename: "$baseFilename
# convert -trim -resize 500x200 ${baseFilename}.png ${baseFilename}.trim.500x200.png
convert -trim -resize 1000x400 ${baseFilename}.png ${baseFilename}.1000x400.png
# convert -crop 1000x350+0+0 ${baseFilename}.1000x400.png ${baseFilename}.1000x350.png
convert ${baseFilename}.1000x400.png $dir/converted_images/${baseFilename}.png
convert ${baseFilename}.1000x400.png $dir/converted_images/${baseFilename}.eps
convert ${baseFilename}.1000x400.png $dir/converted_images/${baseFilename}.svg
done
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment