Skip to content

Commit

Permalink
fix import palettes data and reset
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJoin95 committed Apr 26, 2021
1 parent 9b224bc commit 0c58ca4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion ImageGoNord/GoNord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ImageGoNord/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gonord version
__version__ = "0.1.4"
__version__ = "0.1.5"

from ImageGoNord.GoNord import *
1 change: 1 addition & 0 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 0c58ca4

Please sign in to comment.