@@ -290,29 +290,25 @@ export class GIFGenerator {
290290 return buffer ;
291291 }
292292
293- /** Render a representative still frame to a square PNG (Spectrum border preserved ). */
293+ /** Render a representative still frame to a 4:3 PNG (Spectrum border included ). */
294294 async generatePngFromTAP ( tapData : Buffer , machineType : number = 48 ) : Promise < Buffer > {
295295 const { frames } = await this . captureFrames ( tapData , machineType , false ) ;
296296 const frame = frames [ frames . length - 1 ] ?? frames [ 0 ] ;
297297 if ( ! frame ) throw new Error ( 'No frame captured' ) ;
298298 return this . encodePng ( frame ) ;
299299 }
300300
301- /** ffmpeg-encode one decoded frame to a square PNG, padding the (landscape) frame
302- * with black so a rounded/tilted card crop never truncates the screen content. */
301+ /** ffmpeg-encode one decoded frame to a PNG at its native 4:3 size (border
302+ * included). The card fills it with object-fit: cover, so the outer border
303+ * is cropped to the square crop, not the screen. */
303304 private async encodePng ( frame : Uint8Array ) : Promise < Buffer > {
304305 const width = this . decoder . getWidth ( ) ;
305306 const height = this . decoder . getHeight ( ) ;
306307 const rgba = this . decoder . decode ( frame ) ;
307308 const outPath = join ( tmpdir ( ) , `zxshot-${ process . pid } -${ Date . now ( ) } .png` ) ;
308309
309- // Pad the landscape frame (border included) to a centred square so the
310- // card's rounded corners clip black margin, not the Spectrum screen.
311- const pad = 'pad=iw:iw:0:(iw-ih)/2:black' ;
312-
313310 const args = [
314311 '-f' , 'rawvideo' , '-pix_fmt' , 'rgba' , '-s' , `${ width } x${ height } ` , '-i' , 'pipe:0' ,
315- '-vf' , pad ,
316312 '-frames:v' , '1' ,
317313 '-y' , outPath ,
318314 ] ;
0 commit comments