GithubHelp home page GithubHelp logo

kathi-fletcher / openstax-anatomy-book Goto Github PK

View Code? Open in Web Editor NEW

This project forked from philschatz/epub-anatomy

0.0 2.0 0.0 204.5 MB

Anatomy and Physiology test data

Home Page: openstaxcollege.org

openstax-anatomy-book's Introduction

epub-anatomy

now with epub viewer

Anatomy and Physiology test data

Converting EPS files to SVG

Install ghostscript (gs) and inkscape:

brew install ghostscript inkscape

Then, for each EPS file:

echo "$1" # Path to the EPS file (mminus the extension)
gs -dEPSCrop -dEPSFitPage -sDEVICE=pdfwrite -o temp.pdf "$1.eps" 2> /dev/null > /dev/null
/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-plain-svg="$1.svg" -z temp.pdf 2> /dev/null

Full script:

RESOURCES_DIR=./resources

mkdir ${RESOURCES_DIR}

echo "Converting EPS files to SVG"
find $1 -name "*.eps" -print0 | while read -d $'\0' EPS_PATH
do
  FILE_PATH=$(dirname "${EPS_PATH}")
  FILE_NAME=$(basename "${EPS_PATH}" .eps)
  #echo "${EPS_PATH}"
  echo "${FILE_PATH}/${FILE_NAME}"
  gs -dEPSCrop -dEPSFitPage -sDEVICE=pdfwrite -o temp.pdf "${EPS_PATH}" 2> /dev/null > /dev/null
  /Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-plain-svg="${FILE_PATH}/${FILE_NAME}.svg" -z temp.pdf 2> /dev/null

  # Copy to resources and prettify (for easy diffing) the SVG
  xmllint --nsclean --pretty 2 "${FILE_PATH}/${FILE_NAME}.svg" > "${RESOURCES_DIR}/${FILE_NAME}.svg"
done



# Failed attempts:

#gs -sDEVICE=pdfwrite -o output.pdf ~/Downloads/art-unzipped/A\&P_Chapter10_Final_Arts/1003_Thick_and_Thin_Filaments.eps
#/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-plain-svg=output.svg -z output.pdf

#gs -dEPSCrop -dEPSFitPage -sDEVICE=pdfwrite -o temp.pdf "$1.eps" 2> /dev/null > /dev/null
#/Applications/Inkscape.app/Contents/Resources/bin/inkscape --export-plain-svg="$1.svg" -z temp.pdf 2> /dev/null


#rm "$1.png"

openstax-anatomy-book's People

Contributors

philschatz avatar

Watchers

James Cloos avatar Kathi Fletcher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.