Found on http://mybyways.com/blog/fixing-powerpoint-tiff-images-and-fonts
-
-
Save L-U-C-K-Y/b340a02eab59ea3467924cfebe9d57b1 to your computer and use it in GitHub Desktop.
Compress PPTX
This file contains hidden or 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/bash | |
if [[ -z $1 ]]; then echo $0 input_pptx [output_pptx]; exit; fi | |
if [[ ! -f $1 ]]; then echo File $1 not found; exit; fi | |
if [[ -z $2 ]]; then out=${1/.pptx/-compressed.pptx}; else out=$2; fi | |
[[ -d xtractd ]] && rm -i -r xtractd | |
[[ -f $out ]] && rm -i "$out" | |
unzip "$1" -d xtractd | |
cd xtractd/ppt/media | |
for x in *.tiff; do sips -s format png $x --out ${x/.tiff/.png}; done | |
rm *.tiff | |
# resize images to 1920 | |
sips -Z 1920 *.png | |
sips -Z 1920 *.jpg | |
# compress images | |
/Applications/ImageOptim.app/Contents/MacOS/ImageOptim *.png *.jpg *.jpeg *.svg | |
cd .. | |
sed -i '' -e 's/\(Target="[^"]*\)tiff"/\1png"/g' slides/_rels/*.rels | |
# sed -i '' -e 's/\(typeface="\)[^"]*"/\1Calibri"/g' slides/*.xml notesSlides/*.xml slideLayouts/*.xml slideMasters/*.xml | |
cd .. | |
zip -r "../$out" * | |
cd .. | |
rm -r xtractd | |
# open "$out" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created a repo: https://github.com/L-U-C-K-Y/Reduce-PowerPoint-File-Size