diff --git a/ImageGoNord/GoNord.py b/ImageGoNord/GoNord.py index 9e034d8..a57ce77 100755 --- a/ImageGoNord/GoNord.py +++ b/ImageGoNord/GoNord.py @@ -8,6 +8,14 @@ from PIL import Image, ImageFilter +try: + import importlib.resources as pkg_resources +except ImportError: + # Try backported to PY<37 `importlib_resources`. + import importlib_resources as pkg_resources + +from .palettes import Nord as nord_palette + from ImageGoNord.utility.quantize import quantize_to_palette import ImageGoNord.utility.palette_loader as pl from ImageGoNord.utility.ConvertUtility import ConvertUtility @@ -127,7 +135,8 @@ class GoNord(object): DEFAULT_PALETTE_PATH = '../palettes/Nord/' if (os.path.exists('../palettes/Nord/') == False): - DEFAULT_PALETTE_PATH = 'ImageGoNord/palettes/Nord/' + pa = pkg_resources.open_text(nord_palette, NordPaletteFile.AURORA) + DEFAULT_PALETTE_PATH = os.path.dirname(nord_palette.__file__) + '/' PALETTE_LOOKUP_PATH = DEFAULT_PALETTE_PATH USE_GAUSSIAN_BLUR = False diff --git a/ImageGoNord/__init__.py b/ImageGoNord/__init__.py index e3e0f96..f8772a0 100755 --- a/ImageGoNord/__init__.py +++ b/ImageGoNord/__init__.py @@ -1,4 +1,4 @@ # gonord version -__version__ = "0.1.4" +__version__ = "0.1.5" from ImageGoNord.GoNord import * \ No newline at end of file diff --git a/index.py b/index.py index d639f66..cd87d9c 100755 --- a/index.py +++ b/index.py @@ -7,6 +7,7 @@ # E.g. Avg algorithm and less colors go_nord.enable_avg_algorithm() # go_nord.reset_palette() +# go_nord.set_palette_lookup_path('./mypalette') # go_nord.add_file_to_palette(NordPaletteFile.POLAR_NIGHT) # go_nord.add_file_to_palette(NordPaletteFile.SNOW_STORM) # go_nord.add_color_to_palette('#FF0000') diff --git a/setup.py b/setup.py index 7c61cbc..14af137 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="image-go-nord", - version="0.1.4", + version="0.1.5", description="A tool for converting RGB image to Nordtheme palette", long_description=README, long_description_content_type="text/markdown",