Skip to content

Commit

Permalink
Pillow should not be used with oxipng
Browse files Browse the repository at this point in the history
  • Loading branch information
PoomSmart committed Jan 28, 2023
1 parent 85a1aba commit 43945e2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
5 changes: 2 additions & 3 deletions resize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 2 additions & 8 deletions shared.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from io import BytesIO
from fontTools import ttLib
from PIL import Image as PImage

debug = False
global convert_skin
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 43945e2

Please sign in to comment.