Ticket #1576: optimize-images

File optimize-images, 443 bytes (added by xeen, 16 months ago)

Script that optimizes all PNGs in images/ without causing an alpha transparency bug

Line 
1#!/bin/sh
2
3for x in $(find images/ -name "*.png"); do
4        echo "Processing ${x}"
5        identify -quiet -verbose "${x}" | grep "alpha: 1-bit" > /dev/null
6        if [ "$?" -ne "0" ]; then
7                # non-1-bit-alpha image, process normally
8                optipng -o7 -quiet "${x}"
9        else
10                # disable color type reduction because that will break
11                # transparency for the images in JOSM using the current
12                # image loading method (see #1576)
13                optipng -nc -o7 -quiet "${x}"
14        fi
15done