From ccbb6980d98b9eeb756f9c02487ec8ee2953a8d9 Mon Sep 17 00:00:00 2001 From: kris Date: Sat, 27 Nov 2021 10:43:41 +0000 Subject: [PATCH] Load data files relative to script path --- convert_dhr.py | 4 +++- convert_shr.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/convert_dhr.py b/convert_dhr.py index c769bdf..6e2d5df 100644 --- a/convert_dhr.py +++ b/convert_dhr.py @@ -13,7 +13,9 @@ import image as image_py def convert(screen, rgb: np.ndarray, args): # Conversion matrix from RGB to CAM16UCS colour values. Indexed by # 24-bit RGB value - rgb24_to_cam16ucs = np.load("data/rgb24_to_cam16ucs.npy") + base_dir = os.path.dirname(__file__) + rgb24_to_cam16ucs = np.load( + os.path.join(base_dir, "data/rgb24_to_cam16ucs.npy")) dither = dither_pattern.PATTERNS[args.dither]() bitmap = dither_dhr_pyx.dither_image( diff --git a/convert_shr.py b/convert_shr.py index 5db67f6..40e955a 100644 --- a/convert_shr.py +++ b/convert_shr.py @@ -358,8 +358,11 @@ class ClusterPalette: def convert(screen, rgb: np.ndarray, args): # Conversion matrix from RGB to CAM16UCS colour values. Indexed by # 24-bit RGB value - rgb24_to_cam16ucs = np.load("data/rgb24_to_cam16ucs.npy") - rgb12_iigs_to_cam16ucs = np.load("data/rgb12_iigs_to_cam16ucs.npy") + base_dir = os.path.dirname(__file__) + rgb24_to_cam16ucs = np.load( + os.path.join(base_dir, "data/rgb24_to_cam16ucs.npy")) + rgb12_iigs_to_cam16ucs = np.load( + os.path.join(base_dir, "data/rgb12_iigs_to_cam16ucs.npy")) # TODO: flags inner_iterations = 10