From 43945e2c785839859aa95d421e810e2f7e21a454 Mon Sep 17 00:00:00 2001 From: Thatchapon Unprasert Date: Sat, 28 Jan 2023 15:20:16 +0700 Subject: [PATCH] Pillow should not be used with oxipng --- QUICKSTART.md | 1 - README.md | 1 - resize.sh | 5 ++--- shared.py | 10 ++-------- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/QUICKSTART.md b/QUICKSTART.md index 73d1243..e26f8fd 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -6,7 +6,6 @@ macOS machine with homebrew and Python 3.7+ installed, assumed: ``` bash -c "pip3 install afdko fonttools[repacker]" -pip3 install --upgrade Pillow brew install pngquant freetype imagemagick librsvg inkscape php ``` diff --git a/README.md b/README.md index 204dba0..bfe8894 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ Python and shell scripts to backport and theme [Apple Color Emoji font](https:// - [Python 3.7 or later](http://www.python.org/download/) - [pip](https://pip.pypa.io/en/stable/) - [fonttools](https://github.com/fonttools/fonttools) (`pip3 install fonttools[repacker]`) -- [Pillow](https://pillow.readthedocs.io/en/stable/) (`pip3 install --upgrade Pillow`) - [afdko](https://github.com/adobe-type-tools/afdko) (`pip3 install afdko`) - [pngquant](https://pngquant.org) (`brew install pngquant`) - [oxipng](https://github.com/shssoichiro/oxipng) (`brew install oxipng`) diff --git a/resize.sh b/resize.sh index 3c90030..965d124 100755 --- a/resize.sh +++ b/resize.sh @@ -34,6 +34,5 @@ else fi wait -# echo "Optimizing PNGs using zopflipng (slow)..." -# zopflipng --prefix $NAME/images/*/*.png &> /dev/null -# rename -f 's/(zopfli_)(.*)\.png/$2\.png/' $NAME/images/*/*.png +echo "Optimizing PNGs using oxipng..." +oxipng -q $NAME/images/*/*.png diff --git a/shared.py b/shared.py index bb12696..c806f9b 100644 --- a/shared.py +++ b/shared.py @@ -1,6 +1,4 @@ -from io import BytesIO from fontTools import ttLib -from PIL import Image as PImage debug = False global convert_skin @@ -247,12 +245,8 @@ def base_norm_special(name: str, with_variant_selector = False): return name def get_image_data(path: str): - with PImage.open(path) as fin: - stream = BytesIO() - fin.save(stream, format='png') - data = stream.getvalue() - del stream - return data + with open(path, 'rb') as fin: + return fin.read() def prepare_strikes(f: ttLib.TTFont): if 160 in f['sbix'].strikes: