[pacman-dev] [PATCH 1/1] add option to optimize PNG images with optipng

Florian Pritz bluewind at xinu.at
Fri Jan 23 14:40:46 UTC 2015


On 22.01.2015 09:36, Christian Hesse wrote:
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1918,6 +1918,17 @@ tidy_install() {
>  			fi
>  		done
>  	fi
> +
> +	if check_option "optipng" "y"; then
> +		msg2 "$(gettext "Optimizing PNG images...")"
> +		local png
> +		find . -type f -iname "*.png" 2>/dev/null | while read -r png ; do
> +			if [[ $(file -bi "$png") = *'image/png'* ]]; then

Better use "file -b --mime-type" and get rid of the globs.

> +				optipng "$png" &>/dev/null ||
> +					warning "$(gettext "Could not optimize PNG image : %s")" "${png/$pkgdir\//}"
> +			fi
> +		done
> +	fi
>  }
>  
>  find_libdepends() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20150123/d2b0314e/attachment.asc>


More information about the pacman-dev mailing list