2
0
MasterPassword/Scripts/convertImages
Maarten Billemont 44911f1d9e Improvements to UI cleanup, confirm new master passwords, texts updates.
[FIXED]     Immediately open the application on the password entry view
            if the key is forgotten instead of revealing the internals
            in a blink.
[FIXED]     Clean up the UI better when switching between master
            passwords.
[ADDED]     Ask spelling confirmation when a master password is used
            that doesn't have any known sites yet.
[ADDED]     iPad HD quality icon.
[IMPROVED]  Artworks re-generated, downscale improved, convertImages
            improved.
[IMPROVED]  Small guide text improvements.
[UPDATED]   Help texts updated for current operation and UI.
2012-05-20 20:00:39 +02:00

61 lines
1.6 KiB
Bash
Executable File

#! /usr/bin/env bash
source bashlib
cd "${0%/*}/../Resources"
PATH+=:/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
temp="${TMPDIR:-/tmp}/.$$.convertImages"
mkdir "$temp" || err "Couldn't create temp directory." || return
trap 'rmdir "$temp"' EXIT
downsize() {
local from=$1 to=$2 size=${3:-50%}
convert "$from" -filter box -resize "$size" -unsharp 1x1+1+0.4 "$to"
pngcrush -d "$temp" -rem gAMA -rem cHRM -rem sRGB -rem iCCP "$to" && mv "$temp/"* "$to"
}
inf "Converting iTunesArtwork"
icons=(
[57]="Icon.png"
[114]="Icon@2x.png"
[72]="Icon-72.png"
[144]="Icon-72@2x.png"
[29]="Icon-Small.png"
[58]="Icon-Small@2x.png"
[50]="Icon-Small-50.png"
[100]="Icon-Small-50@2x.png"
)
for size in "${!icons[@]}"; do
file=${icons[size]}
if [[ "iTunesArtwork.png" -nt $file ]]; then
pinf "$file ($size px)"
downsize "iTunesArtwork.png" "$file" "${size}x${size}"
fnip
fi
done
hr
inf "Converting @2x/-hd artwork"
for file in ./**/*{@2x,-ipadhd,-hd}.png; do
inArray "${file##*/}" "${icons[@]}" && continue
[[ ! -e $file ]] && continue
dest=${file/@(@2x|-hd)}
dest=${dest/-ipadhd/-ipad}
if [[ $file = Default* ]]; then
read width height < <(identify -format '%w %h' "$file")
if (( width > height )); then
emit "Rotating $file" --
mogrify -rotate 90 "$file"
emit -$?
fi
fi
if [[ ! -e $dest || "$file" -nt "$dest" ]]; then
pinf "$file -> $dest"
downsize "$file" "$dest"
fnip
fi
done