Last active
September 7, 2017 09:48
-
-
Save yoya/db0851416f3462bcdd0a6a7fd7fc014f to your computer and use it in GitHub Desktop.
AI (Adobe Illustrator) BitmapImage & Text Extractor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# AI (Adobe Illustrator) BitmapImage & Text Extractor. | |
# only "PDF compatible":true | |
# (c) 2017/09/07- yoya@awm.jp | |
# require) | |
# % brew install fswatch poppler epstool | |
# execute) MacOS | |
# % fswatch -0 ~/QUANT/working | xargs -0 -n 1 sh ./ai_extract.sh | |
# test) | |
# % cp -r AIFiles/* ~/QUANT/working/. | |
filename=$1 | |
if [ ! -e "$filename" ]; then | |
exit 0; | |
fi | |
echo $filename | |
dirname=`dirname "$filename"` | |
basename=`basename "${filename%.*}"`; | |
output="$dirname/$basename"; | |
case "$filename" in | |
*\.[aA][iI]) | |
pdfimages -png -j "$filename" "$output" | |
pdftotext "$filename" "$output".txt | |
;; | |
*\.[eE][pP][sS]) | |
epstool --bitmap "$filename" "$output".png # pnm | |
mogrify "$output".png | |
;; | |
*) | |
# echo "Not .ai .eps suffix" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment