Skip to content

Commit

Permalink
Initial attempt for importlib_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Feb 10, 2021
1 parent ee2a85d commit a9e2655
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jaraco/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from collections import namedtuple

import PIL.Image
import pkg_resources
import jaraco.clipboard
from importlib_resources import files


def calc_aspect(size):
Expand Down Expand Up @@ -58,8 +58,8 @@ def resize_with_aspect(image, max_size, *args, **kargs):


def load_apng():
apng = pkg_resources.resource_stream(__name__, 'sample.png')
return PIL.Image.open(io.BytesIO(apng.read()))
apng = files('jaraco') / 'sample.png'
return PIL.Image.open(io.BytesIO(apng.read_bytes()))


def get_image():
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ python_requires = >=3.6
install_requires =
jaraco.clipboard
pillow
importlib_resources >= 3.2
setup_requires = setuptools_scm[toml] >= 3.4.1

[options.packages.find]
Expand Down

0 comments on commit a9e2655

Please sign in to comment.