@@ -6,7 +6,6 @@ import chokidar from 'chokidar';
66import path from 'path' ;
77import fs from 'fs' ;
88import promClient from 'prom-client' ;
9- import Jimp from 'jimp' ;
109import { Logger } from '../logger' ;
1110import { RenderingConfig } from '../config/rendering' ;
1211import { HTTPHeaders , ImageRenderOptions , RenderOptions } from '../types' ;
@@ -106,19 +105,7 @@ export class Browser {
106105 }
107106
108107 options . deviceScaleFactor = parseFloat ( ( ( options . deviceScaleFactor as string ) || '1' ) as string ) || 1 ;
109-
110- // Scaled thumbnails
111- if ( options . deviceScaleFactor <= 0 ) {
112- options . scaleImage = options . deviceScaleFactor * - 1 ;
113- options . deviceScaleFactor = 1 ;
114-
115- if ( options . scaleImage > 1 ) {
116- options . width *= options . scaleImage ;
117- options . height *= options . scaleImage ;
118- } else {
119- options . scaleImage = undefined ;
120- }
121- } else if ( options . deviceScaleFactor > this . config . maxDeviceScaleFactor ) {
108+ if ( options . deviceScaleFactor > this . config . maxDeviceScaleFactor ) {
122109 options . deviceScaleFactor = this . config . deviceScaleFactor ;
123110 }
124111 }
@@ -408,24 +395,6 @@ export class Browser {
408395 return page . screenshot ( { path : options . filePath , fullPage : options . fullPageImage , captureBeyondViewport : false } ) ;
409396 } ) ;
410397
411- if ( options . scaleImage && ! isPDF ) {
412- await this . performStep ( 'imageResize' , options . url , signal , async ( ) => {
413- const scaled = `${ options . filePath } _${ Date . now ( ) } _scaled.png` ;
414- const w = + options . width / options . scaleImage ! ;
415- const h = + options . height / options . scaleImage ! ;
416-
417- const file = await Jimp . read ( options . filePath ) ;
418- await file
419- . resize ( w , h )
420- // .toFormat('webp', {
421- // quality: 70, // 80 is default
422- // })
423- . writeAsync ( scaled ) ;
424-
425- fs . renameSync ( scaled , options . filePath ) ;
426- } ) ;
427- }
428-
429398 return { filePath : options . filePath } ;
430399 }
431400
0 commit comments