Created
May 20, 2016 09:56
-
-
Save pgassmann/04bc71df200b4ffca9842a690e1529ad to your computer and use it in GitHub Desktop.
Convert and resize black and white tif images to resized transparent, white pngs
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 | |
# Convert and resize black and white tif images to resized transparent, white pngs | |
# convert utility from imagemagick | |
# Author: Philipp Gassmann <[email protected]> | |
# source: logo in multiple languages in folder translated as en.tif, de.tif etc. | |
# target: converted/logo_en.png ..., converted/[email protected] ... | |
for original in translated/*.tif ; do | |
convert $original -colorspace sRGB -depth 24 \ | |
-transparent white -fill white -opaque black \ | |
-resize 'x77' \ | |
-unsharp 0x5 -colorspace RGB \ | |
-set filename:fname 'logo_%t' png:'converted/%[filename:fname].png' | |
done | |
# HiDPI / Retina, double the size | |
for original in translated/*.tif ; do | |
convert $original -colorspace sRGB -depth 24 \ | |
-transparent white -fill white -opaque black \ | |
-resize 'x154' \ | |
-unsharp 0x5 -colorspace RGB \ | |
-set filename:fname 'logo_%t@2x' png:'converted/%[filename:fname].png' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment