@@ -35,16 +35,21 @@ def _encodeSnapshot(self, snapshot):
3535 def _convertSnapshotToGcode (self , encoded_snapshot , width , height , chunk_size = 78 ):
3636 gcode = []
3737
38+ use_thumbnail = self .getSettingValueByKey ("use_thumbnail" )
39+ use_star = self .getSettingValueByKey ("use_star" )
40+
3841 encoded_snapshot_length = len (encoded_snapshot )
42+ image_type = "thumbnail" if use_thumbnail else "png"
43+ resolution_symbol = '*' if use_star else 'x'
3944 gcode .append (";" )
40- gcode .append ("; thumbnail begin {}x {} {}" .format (
41- width , height , encoded_snapshot_length ))
45+ gcode .append ("; {} begin {}{} {} {}" .format (
46+ image_type , width , resolution_symbol , height , encoded_snapshot_length ))
4247
4348 chunks = ["; {}" .format (encoded_snapshot [i :i + chunk_size ])
4449 for i in range (0 , len (encoded_snapshot ), chunk_size )]
4550 gcode .extend (chunks )
4651
47- gcode .append ("; thumbnail end" )
52+ gcode .append ("; {} end" . format ( image_type ) )
4853 gcode .append (";" )
4954 gcode .append ("" )
5055
@@ -79,6 +84,20 @@ def getSettingDataString(self):
7984 "minimum_value": "0",
8085 "minimum_value_warning": "12",
8186 "maximum_value_warning": "600"
87+ },
88+ "use_thumbnail":
89+ {
90+ "label": "Thumbnail Begin/End",
91+ "description": "Use Thumbnail Begin/End rather than PNG",
92+ "type": "bool",
93+ "default_value": true
94+ },
95+ "use_star":
96+ {
97+ "label": "Use '*' for size of image",
98+ "description": "Use '*' instead of 'x' for size of image as Width '*' Height",
99+ "type": "bool",
100+ "default_value": false
82101 }
83102 }
84103 }"""
0 commit comments