Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Find big images in PowerPoint
# get the parameter
echo "working on" $1
rm -r /tmp/big-images
mkdir /tmp/big-images
# copy the ppt file to /tmp
cp $1 /tmp/big-images
# rename it to be .zip
mv /tmp/big-images/$1 /tmp/big-images/$
# unzip it
echo "unzipping /tmp/big-images/$"
# quiet mode and use the directory after the -d
unzip -q /tmp/big-images/$ -d /tmp/big-images
# list the large images in a PPT file
ls -lS /tmp/big-images/ppt/media | awk '{if ($5 >=100000) print $5, $9}' >/tmp/big-images/big-images-sizes.txt
awk '{print $2}' </tmp/big-images/big-images-sizes.txt >/tmp/big-images/big-images-names.txt
# get the list of names only
echo "Copy any of the following lines into the shell to view the image"
awk '{print "open /tmp/big-images/ppt/media/"$1}' </tmp/big-images/big-images-names.txt
# get a list of all the media that is larger than 100K
echo "The following images are over 100K bytes"
cat /tmp/big-images/big-images-sizes.txt
# show what slides they are on
echo "\n The images are on the following slides:"
awk '{print "grep -l " $1 " /tmp/big-images/ppt/slides/_rels/*.rels"}' </tmp/big-images/big-images-names.txt | /bin/sh \
| sed 's/\/tmp\/big-images\/ppt\/slides\/_rels\///'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment