@@ -9,15 +9,15 @@ const outputFolder = 'output';
99/**
1010 * Function to slice an image into smaller segments
1111 */
12- function sliceImage ( filename , width , height , skipExtCheck ) {
12+ function sliceImage ( filename , width , height , canvasWidth , canvasHeight , skipExtCheck ) {
1313 Jimp . read ( filename , ( err , image ) => {
1414 if ( err && skipExtCheck ) {
1515 console . error ( err ) ;
1616 }
1717 else {
1818 // Continue slicing if image is successfully read
1919 if ( image ) {
20- continueSlicing ( image , width , height , filename ) ;
20+ continueSlicing ( image , width , height , canvasWidth , canvasHeight , filename ) ;
2121 return ;
2222 }
2323 }
@@ -35,7 +35,7 @@ function sliceImage(filename, width, height, skipExtCheck) {
3535 Jimp . read ( fullFilename , ( err , image ) => {
3636 if ( ! foundImage && ! err ) {
3737 foundImage = true ;
38- continueSlicing ( image , width , height , fullFilename ) ;
38+ continueSlicing ( image , width , height , canvasWidth , canvasHeight , fullFilename ) ;
3939 }
4040 } ) ;
4141 }
@@ -45,7 +45,7 @@ exports.sliceImage = sliceImage;
4545/**
4646 * Continue slicing the image into smaller segments
4747 */
48- function continueSlicing ( image , width , height , inputFilename ) {
48+ function continueSlicing ( image , width , height , canvasWidth , canvasHeight , inputFilename ) {
4949 // If height is not specified, use width as height
5050 height = height || width ;
5151 const imageWidth = image . getWidth ( ) ;
@@ -77,6 +77,6 @@ function continueSlicing(image, width, height, inputFilename) {
7777if ( ! worker_threads_1 . isMainThread ) {
7878 const { filePath, options } = worker_threads_1 . workerData ;
7979 options . filename = filePath ;
80- const { filename, width, height } = options ;
81- sliceImage ( filename , width , height , true ) ;
80+ const { filename, width, height, canvasWidth , canvasHeight } = options ;
81+ sliceImage ( filename , width , height , canvasWidth , canvasHeight , true ) ;
8282}
0 commit comments