File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
internal_filesystem/apps/com.micropythonos.camera/assets Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ def onResume(self, screen):
116116 print (f"camera app: webcam exception: { e } " )
117117 if self .cam :
118118 print ("Camera app initialized, continuing..." )
119+ self .set_image_size ()
119120 self .capture_timer = lv .timer_create (self .try_capture , 100 , None )
120121 self .status_label_cont .add_flag (lv .obj .FLAG .HIDDEN )
121122 if self .scanqr_mode :
@@ -139,6 +140,20 @@ def onStop(self, screen):
139140 self .cam .deinit ()
140141 print ("camera app cleanup done." )
141142
143+ def set_image_size (self ):
144+ target_h = mpos .ui .vertical_resolution
145+ target_w = target_h
146+ if target_w == self .width and target_h == self .height :
147+ print ("Target width and height are the same as native image, no scaling required." )
148+ return
149+ print (f"scaling to size: { target_w } x{ target_h } " )
150+ scale_factor_w = round (target_w * 256 / self .width )
151+ scale_factor_h = round (target_h * 256 / self .height )
152+ print (f"scale_factors: { scale_factor_w } ,{ scale_factor_h } " )
153+ self .image .set_size (target_w , target_h )
154+ #self.image.set_scale(max(scale_factor_w,scale_factor_h)) # fills the entire screen but cuts off borders
155+ self .image .set_scale (min (scale_factor_w ,scale_factor_h ))
156+
142157 def qrdecode_one (self ):
143158 try :
144159 import qrdecode
You can’t perform that action at this time.
0 commit comments