Skip to content

Instantly share code, notes, and snippets.

@krlmlr
Created January 3, 2014 15:14
Show Gist options
  • Save krlmlr/8239458 to your computer and use it in GitHub Desktop.
Save krlmlr/8239458 to your computer and use it in GitHub Desktop.
Various scripts for transcoding images (2010, IVT)
#!/bin/sh
# -dt = draw text as curves
# -rgb = use rgb color model
pstoedit -rgb -dt -f ps sc-logo.pdf sc-logo.ps
# above command produces invalid PostScript with two restores too much
# remove the two restores
head -n -9 sc-logo.ps > sc-logo2.ps
echo "%%EOF" >> sc-logo2.ps
# set bounding box
# -g uses bbox device of ghostscript
# --ignoreBB ignores the current bounding box in the file
ps2eps -f -c -g --ignoreBB sc-logo2.ps
# make a correctly cropped PDF file
ps2pdf -dEPSCrop sc-logo2.eps
#!/bin/sh
pdftops sc-logo.pdf
ps2pdf sc-logo.ps sc-logo.ps.pdf
pstoedit -rgb -dt -f ps sc-logo.ps sc-logo2.ps
ps2pdf sc-logo2.ps sc-logo2.ps.pdf
ps2eps -f -c -g --ignoreBB sc-logo2.ps
ps2pdf sc-logo2.eps sc-logo2.eps.pdf
ps2pdf -dEPSCrop sc-logo2.eps
#!/bin/sh
gs -dNOPAUSE -dBATCH -dEPSCrop -sDEVICE=png16m -sOutputFile=sc-logo2.pdf.ps.png -r300 sc-logo.pdf.ps
#!/bin/sh
# -dt = draw text as curves
# -rgb = use rgb color model
pstoedit -rgb -dt -f ps sc-logo.pdf sc-logo.ps
# above command produces invalid PostScript with two restores too much
# remove the two restores
head -n -9 sc-logo.ps > sc-logo2.ps
echo "%%EOF" >> sc-logo2.ps
# set bounding box
# -g uses bbox device of ghostscript
# --ignoreBB ignores the current bounding box in the file
ps2eps -f -c -g --ignoreBB sc-logo2.ps
# make a correctly cropped PDF file
ps2pdf -dEPSCrop sc-logo2.eps
#!/bin/sh
FILENAME=EmblemeEuropeenFP7.pdf
# -dt = draw text as curves
# -rgb = use rgb color model
pstoedit -rgb -f ps $FILENAME $FILENAME.ps
# above command produces invalid PostScript with two restores too much
# remove the two restores
head -n -9 $FILENAME.ps > $FILENAME.2.ps
echo "%%EOF" >> $FILENAME.2.ps
# set bounding box
# -g uses bbox device of ghostscript
# --ignoreBB ignores the current bounding box in the file
ps2eps -f -c -g --ignoreBB $FILENAME.2.ps
# make a correctly cropped PDF file
ps2pdf -dEPSCrop $FILENAME.2.eps
gs -r300 -sDEVICE=png16m -sOutputFile=$FILENAME.2.300.png -dBATCH -dNOPAUSE $FILENAME.2.eps
gs -r600 -sDEVICE=png16m -sOutputFile=$FILENAME.2.600.png -dBATCH -dNOPAUSE $FILENAME.2.eps
gs -r120 -sDEVICE=png16m -sOutputFile=$FILENAME.2.1200.png -dBATCH -dNOPAUSE $FILENAME.2.eps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment