File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -575,6 +575,9 @@ class Canvas(_CanvasBase):
575
575
#: This property has no effect on Safari, see https://bugs.webkit.org/show_bug.cgi?id=198416
576
576
filter = Unicode ("none" )
577
577
578
+ #: (bool) Indicates if scaled images are smoothed. Default to True
579
+ image_smoothing_enabled = Bool (True )
580
+
578
581
_line_dash = List ()
579
582
580
583
#: (float) Specifies where to start a dash array on a line. Default is ``0.``.
@@ -614,6 +617,7 @@ class Canvas(_CanvasBase):
614
617
"shadow_blur" : 15 ,
615
618
"shadow_color" : 16 ,
616
619
"filter" : 17 ,
620
+ "image_smoothing_enabled" : 18 ,
617
621
}
618
622
619
623
def __init__ (self , * args , ** kwargs ):
Original file line number Diff line number Diff line change @@ -27,7 +27,9 @@ def image_bytes_to_array(im_bytes):
27
27
28
28
def binary_image (ar , quality = 75 ):
29
29
f = BytesIO ()
30
- if ar .shape [2 ] == 3 :
30
+ if len (ar .shape ) == 2 :
31
+ filetype = "PNG"
32
+ elif ar .shape [2 ] == 3 :
31
33
filetype = "JPEG"
32
34
else :
33
35
filetype = "PNG"
Original file line number Diff line number Diff line change @@ -609,7 +609,8 @@ export class CanvasModel extends DOMWidgetModel {
609
609
'shadowOffsetY' ,
610
610
'shadowBlur' ,
611
611
'shadowColor' ,
612
- 'filter'
612
+ 'filter' ,
613
+ 'imageSmoothingEnabled'
613
614
] ;
614
615
615
616
initialize ( attributes : any , options : any ) {
You can’t perform that action at this time.
0 commit comments