File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,7 +132,11 @@ def __init__(
132132 self ._vmin = ImageVmin (vmin )
133133 self ._vmax = ImageVmax (vmax )
134134
135- self ._cmap = ImageCmap (cmap )
135+ # set cmap to None for RGB images
136+ if self ._data .value .ndim == 3 :
137+ self ._cmap = None
138+ else :
139+ self ._cmap = ImageCmap (cmap )
136140
137141 self ._interpolation = ImageInterpolation (interpolation )
138142 self ._cmap_interpolation = ImageCmapInterpolation (cmap_interpolation )
@@ -189,10 +193,14 @@ def data(self, data):
189193 @property
190194 def cmap (self ) -> str :
191195 """colormap name"""
196+ if self .data .value .ndim == 3 :
197+ raise AttributeError ("RGB images do not have a colormap property" )
192198 return self ._cmap .value
193199
194200 @cmap .setter
195201 def cmap (self , name : str ):
202+ if self .data .value .ndim == 3 :
203+ raise AttributeError ("RGB images do not have a colormap property" )
196204 self ._cmap .set_value (self , name )
197205
198206 @property
You can’t perform that action at this time.
0 commit comments