Skip to content

Commit

Permalink
updated LICENSE with pngquant and zopflipng licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissimpkins committed Apr 11, 2016
1 parent 5f51292 commit fc1281d
Show file tree
Hide file tree
Showing 10 changed files with 933 additions and 21 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

738 changes: 738 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions bin/Crunch.app/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>png</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>public.item</string>
<string>public.folder</string>
</array>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>Crunch</string>
<key>CFBundleIconFile</key>
<string>appIcon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.csimpkins.Crunch</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Crunch</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.0 dev-1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.9.0 dev-1</string>
<key>LSMinimumSystemVersion</key>
<string>10.7.0</string>
<key>LSUIElement</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>© 2016 Christopher Simpkins</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Binary file added bin/Crunch.app/Contents/MacOS/Crunch
Binary file not shown.
49 changes: 49 additions & 0 deletions bin/Crunch.app/Contents/Resources/AppSettings.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AcceptsFiles</key>
<true/>
<key>AcceptsText</key>
<false/>
<key>Authentication</key>
<false/>
<key>Creator</key>
<string>Platypus-5.1</string>
<key>Droppable</key>
<true/>
<key>Interpreter</key>
<string>/bin/sh</string>
<key>InterpreterArgs</key>
<array/>
<key>Output</key>
<string>Text Window</string>
<key>PromptForFileOnLaunch</key>
<false/>
<key>RemainRunning</key>
<true/>
<key>ScriptArgs</key>
<array/>
<key>Secure</key>
<false/>
<key>Suffixes</key>
<array>
<string>png</string>
</array>
<key>TextBackground</key>
<string>#20242d</string>
<key>TextEncoding</key>
<integer>4</integer>
<key>TextFont</key>
<string>Monaco</string>
<key>TextForeground</key>
<string>#e6e6e6</string>
<key>TextSize</key>
<real>13</real>
<key>UniformTypes</key>
<array>
<string>public.item</string>
<string>public.folder</string>
</array>
</dict>
</plist>
Binary file added bin/Crunch.app/Contents/Resources/MainMenu.nib
Binary file not shown.
Binary file added bin/Crunch.app/Contents/Resources/appIcon.icns
Binary file not shown.
Binary file added bin/Crunch.app/Contents/Resources/pngquant
Binary file not shown.
91 changes: 91 additions & 0 deletions bin/Crunch.app/Contents/Resources/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/sh

chug_title=" ______ __
| |.----.--.--.-----.----.| |--.
| ---|| _| | | | __|| |
|______||__| |_____|__|__|____||__|__| v0.9.0 dev-1
"

# Message on application open (no arguments passed to script on initial open)
if [[ $# -eq 0 ]]; then
printf '%s\n' "$chug_title"
echo "Insane(ly slow but wicked good) PNG image optimization\n"
echo "Built with pngquant and zopflipng optimizers"
echo "======================================================\n"
echo "Copyright 2016 Christopher Simpkins"
echo "MIT License"
echo "Source: //github.com/chrissimpkins/Crunch\n"
echo "Issues: //github.com/chrissimpkins/Crunch/issues\n"
echo "======================================================\n"
echo " \n"
echo "Drag and drop your PNG images on this window to begin."
fi


for imagepath in "$@"
do
file_extension=${imagepath##*.}
if [[ $file_extension = "png" ]]; then
echo "• • • Crunching $imagepath...\n"
echo " \n"
# get the pre compression size of the image file
pre_size=$(stat -f %z "$imagepath")
printf "Original size (kB): \t%.3f\n" $(bc -l <<< "$pre_size/1000")

working_imagepath="${imagepath%%.*}-crunch.png"

# pngquant run on the file
echo " \n"
echo "==> Running stage 1 optimizations...\n"
./pngquant --quality=80-98 --skip-if-larger --force --ext -crunch.png "$imagepath" >/dev/null

if [[ $? -ne 0 ]]; then
post_pngquant_size=$(stat -f %z "$imagepath")
echo " \n"
printf "Current size (kB): \t%.3f\n" $(bc -l <<< "$post_pngquant_size/1000")
echo " \n"
echo "==> Running stage 2 optimizations...\n"
if [[ $(bc -l <<< "$pre_size") -gt 35000 ]]; then
echo "==> Hold tight. This could take awhile.\n==> Click Cancel at any time to stop processing."
fi
#./zopflipng --splitting=3 --filters=0meb -y --lossy_8bit --lossy_transparent "$imagepath" "${imagepath%%.*}-crunch.png" >/dev/null
./zopflipng -y --lossy_8bit --lossy_transparent "$imagepath" "${imagepath%%.*}-crunch.png" >/dev/null
else
post_pngquant_size=$(stat -f %z "$working_imagepath")
echo " \n"
printf "Current size (kB): \t%.3f\n" $(bc -l <<< "$post_pngquant_size/1000")
echo " \n"
echo "==> Running stage 2 optimizations...\n"
if [[ $(bc -l <<< "$pre_size") -gt 35000 ]]; then
echo "==> Hold tight. This could take awhile.\n==> Click Cancel at any time to save at the above size."
fi

if [[ -f "$working_imagepath" ]]; then
echo " " >/dev/null
else
sleep 2 # pause for two seconds for file write
if [[ -f "$working_imagepath" ]]; then
echo " " >/dev/null
else
echo "[ERROR] Unable to access the file for optimizations. Please report this issue."
fi
fi

#./zopflipng --splitting=3 --filters=0meb -y --lossy_8bit --lossy_transparent "$working_imagepath" "$working_imagepath" >/dev/null
./zopflipng -y "$working_imagepath" "$working_imagepath" >/dev/null
fi

# get the post compression size of the image file
post_zopfli_size=$(stat -f %z "$working_imagepath")
echo " \n"
echo "---\n"
echo "Optimized filepath: $working_imagepath"
printf "Final size (kB): \t%.3f\n" $(bc -l <<< "$post_zopfli_size/1000")
printf "Percent original: \t%.2f%%\n" $(bc -l <<< "($post_zopfli_size/$pre_size) * 100")
printf "Space saved (kB): \t%.3f\n" $(bc -l <<< "($pre_size - $post_zopfli_size) / 1000")
echo "---\n"
echo " \n"
else
echo "ALERT:Unable to Process File|$imagepath does not appear to be a png file"
fi
done
Binary file added bin/Crunch.app/Contents/Resources/zopflipng
Binary file not shown.

0 comments on commit fc1281d

Please sign in to comment.