File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,11 @@ def __init__(
132
132
self ._vmin = ImageVmin (vmin )
133
133
self ._vmax = ImageVmax (vmax )
134
134
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 )
136
140
137
141
self ._interpolation = ImageInterpolation (interpolation )
138
142
self ._cmap_interpolation = ImageCmapInterpolation (cmap_interpolation )
@@ -189,10 +193,14 @@ def data(self, data):
189
193
@property
190
194
def cmap (self ) -> str :
191
195
"""colormap name"""
196
+ if self .data .value .ndim == 3 :
197
+ raise AttributeError ("RGB images do not have a colormap property" )
192
198
return self ._cmap .value
193
199
194
200
@cmap .setter
195
201
def cmap (self , name : str ):
202
+ if self .data .value .ndim == 3 :
203
+ raise AttributeError ("RGB images do not have a colormap property" )
196
204
self ._cmap .set_value (self , name )
197
205
198
206
@property
You can’t perform that action at this time.
0 commit comments