Found on http://mybyways.com/blog/fixing-powerpoint-tiff-images-and-fonts
Created
September 17, 2018 12:19
-
-
Save erkie/905942b406bed296bd1436730f4a8963 to your computer and use it in GitHub Desktop.
Compress PPTX
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/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/.[FIX].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 | |
#/Applications/ImageOptim.app/Contents/MacOS/ImageOptim *.png *.jpg *.jpeg | |
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