diff --git a/doc/WhatsNew.rst b/doc/WhatsNew.rst index 1757f18e0..ee9c33538 100644 --- a/doc/WhatsNew.rst +++ b/doc/WhatsNew.rst @@ -2,6 +2,13 @@ What's New ++++++++++ +Ver 5.3.0 (unreleased) +====================== +- Fixed an issue with editing objects in the Pick plugin +- Fixed an issue where image metadata not always loaded correctly with + Pillow for RGB images +- Added support for Apple HEIF (.HEIC) RGB images if pillow-heif is installed + Ver 5.2.0 (2024-10-21) ====================== - Substituted puremagic package for python-magic (works better across diff --git a/ginga/canvas/CanvasObject.py b/ginga/canvas/CanvasObject.py index ac931597a..da3e3ff27 100644 --- a/ginga/canvas/CanvasObject.py +++ b/ginga/canvas/CanvasObject.py @@ -66,7 +66,7 @@ def __init__(self, **kwdargs): if not hasattr(self, 'kind'): self.kind = None # For debugging - self.name = None + self.name = kwdargs.get('name', None) self.viewer = None # For callbacks diff --git a/ginga/rv/plugins/Pick.py b/ginga/rv/plugins/Pick.py index 232639303..84a487588 100644 --- a/ginga/rv/plugins/Pick.py +++ b/ginga/rv/plugins/Pick.py @@ -1701,9 +1701,9 @@ def create_pick_box(self, obj): obj.color = self.pickcolor args = [obj, - self.dc.Point(x, y, 10, color='red'), + self.dc.Point(x, y, 10, color='red', editable=False), self.dc.Text(x1, y2, '{0}: calc'.format(self._textlabel), - color=self.pickcolor) + color=self.pickcolor, editable=False) ] self.pick_obj = self.dc.CompoundObject(*args) diff --git a/ginga/util/io/io_rgb.py b/ginga/util/io/io_rgb.py index 6f1735e52..97cf1a0b8 100644 --- a/ginga/util/io/io_rgb.py +++ b/ginga/util/io/io_rgb.py @@ -18,6 +18,7 @@ from ginga.misc import Bunch from ginga import trcalc +# optional imports try: # do we have opencv available? import cv2 @@ -32,6 +33,12 @@ except ImportError: have_exif = False +try: + # for opening HEIC (Apple image) files) + from pillow_heif import register_heif_opener + register_heif_opener() +except ImportError: + pass # For testing... #have_exif = False #have_opencv = False @@ -442,7 +449,8 @@ class PillowFileHandler(BaseRGBFileHandler): 'image/bmp', 'image/x-tga', 'image/x-icns', - 'image/vnd.microsoft.icon'] + 'image/vnd.microsoft.icon', + 'image/heif'] @classmethod def check_availability(cls): @@ -559,15 +567,15 @@ def load_idx(self, idx, **kwargs): return data_obj def _get_header(self, image_pil, kwds): - if hasattr(image_pil, '_getexif'): - info = image_pil._getexif() + if hasattr(image_pil, 'getexif'): + info = image_pil.getexif() if info is not None: for tag, value in info.items(): kwd = TAGS.get(tag, tag) kwds[kwd] = value else: - self.logger.warning("can't get EXIF data; no _getexif() method") + self.logger.warning("can't get EXIF data; no getexif() method") # is there an embedded color profile? if 'icc_profile' in image_pil.info: @@ -585,8 +593,8 @@ def _process_image(self, image_pil, metadata=None): if kwds is None: kwds = Header() metadata['header'] = kwds - else: - kwds = Header() + else: + kwds = Header() try: self._get_header(image_pil, kwds) diff --git a/setup.cfg b/setup.cfg index 23718f41e..ad7afe79e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,6 +64,7 @@ recommended = matplotlib>=3.8 opencv-python-headless>=4.5.4 exifread>=2.3.2 + pillow-heif>=0.21.0 astroquery>=0.3.5 python-dateutil>=2.8.2 photutils