Last active
February 26, 2024 16:49
-
-
Save dmccreary/7734b7148f523771adb38597bcbe5732 to your computer and use it in GitHub Desktop.
Find big images in PowerPoint
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 | |
# this program has been updated to list both the images and the largest images and the slide numbers together | |
# get the parameter | |
echo "working on" "$1" | |
rm -r /tmp/big-images 2> /dev/null | |
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/$1.zip" | |
# unzip it | |
echo "unzipping /tmp/big-images/$1.zip" | |
unzip -q "/tmp/big-images/$1.zip" -d /tmp/big-images | |
# find large images | |
find /tmp/big-images/ppt/media/ -type f -size +100k > /tmp/big-images/big-images-list.txt | |
# process each image | |
while IFS= read -r image; do | |
size=$(ls -l "$image" | awk '{print $5}') | |
name=$(basename "$image") | |
slide=$(grep -l "$name" /tmp/big-images/ppt/slides/_rels/*.rels | sed 's/.*slide\(.*\).xml.rels/\1/') | |
echo "Image: $name (Size: $size bytes) is on Slide: $slide" | |
done < /tmp/big-images/big-images-list.txt |
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 | |
# this program has been updated to list both the images and the largest images and the slide numbers together | |
# get the parameter | |
echo "working on" "$1" | |
rm -r /tmp/big-images 2> /dev/null | |
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/$1.zip" | |
# unzip it | |
echo "unzipping /tmp/big-images/$1.zip" | |
unzip -q "/tmp/big-images/$1.zip" -d /tmp/big-images | |
# find large images | |
find /tmp/big-images/ppt/media/ -type f -size +100k > /tmp/big-images/big-images-list.txt | |
# process each image | |
while IFS= read -r image; do | |
size=$(ls -l "$image" | awk '{print $5}') | |
name=$(basename "$image") | |
slide=$(grep -l "$name" /tmp/big-images/ppt/slides/_rels/*.rels | sed 's/.*slide\(.*\).xml.rels/\1/') | |
echo "Image: $name (Size: $size bytes) is on Slide: $slide" | |
done < /tmp/big-images/big-images-list.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great idea. I've tried the latest version. It seems to be having issues:
Here is the output from the previous version: