@@ -55,7 +55,7 @@ const removeDoubles = async (images: string[], dontProcessAll?: boolean) => {
5555 let widthMap = { } as any
5656
5757 for ( let i = 0 ; i < images . length ; i ++ ) {
58- const metadata = await sharp ( images [ i ] ) . metadata ( )
58+ const metadata = await sharp ( images [ i ] , { limitInputPixels : false } ) . metadata ( )
5959 const width = metadata . width || 0
6060 if ( widthMap [ width ] ) {
6161 widthMap [ width ] += 1
@@ -76,7 +76,7 @@ const removeDoubles = async (images: string[], dontProcessAll?: boolean) => {
7676 }
7777
7878 for ( let i = 0 ; i < images . length ; i ++ ) {
79- const metadata = await sharp ( images [ i ] ) . metadata ( )
79+ const metadata = await sharp ( images [ i ] , { limitInputPixels : false } ) . metadata ( )
8080 const width = metadata . width || 0
8181 if ( width > commonWidth * 1.5 ) {
8282 doubleImages . push ( images [ i ] )
@@ -89,16 +89,16 @@ const removeDoubles = async (images: string[], dontProcessAll?: boolean) => {
8989 }
9090
9191 for ( let i = 0 ; i < doubleImages . length ; i ++ ) {
92- const metadata = await sharp ( doubleImages [ i ] ) . metadata ( )
92+ const metadata = await sharp ( doubleImages [ i ] , { limitInputPixels : false } ) . metadata ( )
9393 const width = metadata . width || 0
9494 const height = metadata . height || 0
9595 const newWidth = Math . floor ( width / 2 )
9696 const page1 = `${ path . dirname ( doubleImages [ i ] ) } /${ path . basename ( doubleImages [ i ] , path . extname ( doubleImages [ i ] ) ) } .1${ path . extname ( doubleImages [ i ] ) } `
9797 const page2 = `${ path . dirname ( doubleImages [ i ] ) } /${ path . basename ( doubleImages [ i ] , path . extname ( doubleImages [ i ] ) ) } .2${ path . extname ( doubleImages [ i ] ) } `
98- await sharp ( doubleImages [ i ] )
98+ await sharp ( doubleImages [ i ] , { limitInputPixels : false } )
9999 . extract ( { left : newWidth , top : 0 , width : newWidth , height : height } )
100100 . toFile ( page1 )
101- await sharp ( doubleImages [ i ] )
101+ await sharp ( doubleImages [ i ] , { limitInputPixels : false } )
102102 . extract ( { left : 0 , top : 0 , width : newWidth , height : height } )
103103 . toFile ( page2 )
104104 }
@@ -701,14 +701,14 @@ const compress = async (info: any) => {
701701 const { frameArray, delayArray} = await functions . getGIFFrames ( info . source )
702702 const newFrameArray = [ ] as Buffer [ ]
703703 for ( let i = 0 ; i < frameArray . length ; i ++ ) {
704- const newFrame = await sharp ( frameArray [ i ] )
704+ const newFrame = await sharp ( frameArray [ i ] , { limitInputPixels : false } )
705705 . resize ( width , height , { fit : "fill" } )
706706 . toBuffer ( )
707707 newFrameArray . push ( newFrame )
708708 }
709709 buffer = await functions . encodeGIF ( newFrameArray , delayArray , width , height )
710710 } else {
711- buffer = await sharp ( buffer , { animated : true } ) . resize ( width , height , { fit : "fill" } ) . gif ( ) . toBuffer ( )
711+ buffer = await sharp ( buffer , { animated : true , limitInputPixels : false } ) . resize ( width , height , { fit : "fill" } ) . gif ( ) . toBuffer ( )
712712 }
713713 if ( options . quality !== 100 ) {
714714 buffer = await imagemin . buffer ( buffer , { plugins : [
@@ -724,10 +724,10 @@ const compress = async (info: any) => {
724724 }
725725 } else {
726726 if ( resizeCondition ) {
727- buffer = await sharp ( buffer , { animated : true } ) . resize ( width , height , { fit : "fill" } ) . toBuffer ( )
727+ buffer = await sharp ( buffer , { animated : true , limitInputPixels : false } ) . resize ( width , height , { fit : "fill" } ) . toBuffer ( )
728728 }
729729 if ( sourceExt !== ext ) {
730- let s = sharp ( buffer , { animated : true } )
730+ let s = sharp ( buffer , { animated : true , limitInputPixels : false } )
731731 if ( ext === "jpg" || ext === "jpeg" ) s . jpeg ( { optimiseScans : options . progressive , quality : options . quality } )
732732 if ( ext === "png" ) s . png ( { quality : options . quality } )
733733 if ( ext === "webp" ) s . webp ( { quality : options . quality } )
@@ -819,14 +819,14 @@ ipcMain.handle("compress-realtime", async (event, info: any) => {
819819 const { frameArray, delayArray} = await functions . getGIFFrames ( info . source )
820820 const newFrameArray = [ ] as Buffer [ ]
821821 for ( let i = 0 ; i < frameArray . length ; i ++ ) {
822- const newFrame = await sharp ( frameArray [ i ] )
822+ const newFrame = await sharp ( frameArray [ i ] , { limitInputPixels : false } )
823823 . resize ( width , height , { fit : "fill" } )
824824 . toBuffer ( )
825825 newFrameArray . push ( newFrame )
826826 }
827827 buffer = await functions . encodeGIF ( newFrameArray , delayArray , width , height )
828828 } else {
829- buffer = await sharp ( buffer , { animated : true } ) . resize ( width , height , { fit : "fill" } ) . gif ( ) . toBuffer ( )
829+ buffer = await sharp ( buffer , { animated : true , limitInputPixels : false } ) . resize ( width , height , { fit : "fill" } ) . gif ( ) . toBuffer ( )
830830 }
831831 if ( options . quality !== 100 ) {
832832 buffer = await imagemin . buffer ( buffer , { plugins : [
@@ -842,10 +842,10 @@ ipcMain.handle("compress-realtime", async (event, info: any) => {
842842 }
843843 } else {
844844 if ( resizeCondition ) {
845- buffer = await sharp ( buffer , { animated : true } ) . resize ( width , height , { fit : "fill" } ) . toBuffer ( )
845+ buffer = await sharp ( buffer , { animated : true , limitInputPixels : false } ) . resize ( width , height , { fit : "fill" } ) . toBuffer ( )
846846 }
847847 if ( sourceExt !== ext ) {
848- let s = sharp ( buffer , { animated : true } )
848+ let s = sharp ( buffer , { animated : true , limitInputPixels : false } )
849849 if ( ext === "jpg" || ext === "jpeg" ) s . jpeg ( { optimiseScans : options . progressive , quality : options . quality } )
850850 if ( ext === "png" ) s . png ( { quality : options . quality } )
851851 if ( ext === "webp" ) s . webp ( { quality : options . quality } )
0 commit comments