Skip to content

Instantly share code, notes, and snippets.

@madlymad
Created March 25, 2017 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madlymad/bc02a34a75e78d09fe1f9bea13aeb984 to your computer and use it in GitHub Desktop.
Save madlymad/bc02a34a75e78d09fe1f9bea13aeb984 to your computer and use it in GitHub Desktop.
download swf pages of a book and convert to png files
#!/bin/bash
# Add the number of pages
pages=$((134))
rm -rf *.swf*
mkdir SWF
mkdir PNG
i=$((1))
for j in `seq -w 1 $pages`
do
echo "process page $i"
if [ ! -f "SWF/p$i.swf" ]; then
# change the url to page url
page="http://url_of_your_page/p$i.swf"
echo "download $page"
wget $page
mv *.swf SWF/
fi
if [ ! -f "PNG/p$i.png" ]; then
swfrender -X 1836 -Y 2376 "SWF/p$i.swf" -o "PNG/p$i.png"
fi
mv "PNG/p$i.png" "PNG/p$j.png"
echo "p$i.png -> PNG/p$j.png"
i=`expr $j + 1`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment