--- a/ptpicker.c
+++ b/ptpicker.c
@@ -731,7 +731,7 @@
 		
 		
 	
-	sprintf(line, "p f%d w%ld h%ld v%lg u%d %s n\"%s\" %s\n\n", pf, g->pano.width, g->pano.height, g->pano.hfov, g->st.feather, cv, g->pano.name, ch );
+	sprintf(line, "p f%d w%ld h%ld v%lg u%d %s n\"%s\" %s\n\n", pf, (long int) g->pano.width, (long int) g->pano.height, g->pano.hfov, g->st.feather, cv, g->pano.name, ch );
 	count = strlen( line ); mywrite( fnum, count, line );
 	
 	for(i=0; i<g->numIm; i++)
@@ -743,7 +743,7 @@
 		else
 			sprintf(ch, "v%lg", g->im[i].hfov);
 			
-		sprintf(line, "i f%ld w%ld h%ld y%lg p%lg r%lg %s %s n\"%s\" ", im->format, im->width, im->height, 
+		sprintf(line, "i f%ld w%ld h%ld y%lg p%lg r%lg %s %s n\"%s\" ", (long int) im->format, (long int) im->width, (long int) im->height, 
 											im->yaw, im->pitch, im->roll, 
 											(im->cP.correction_mode & correction_mode_morph ? "o" : "" ),
 											ch, im->name );
@@ -784,8 +784,8 @@
 		}
 
 		if( g->im[i].selection.bottom != 0 || g->im[i].selection.right != 0 ){
-			sprintf( ch, " S%ld,%ld,%ld,%ld ",g->im[i].selection.left, g->im[i].selection.right,
-						       g->im[i].selection.top, g->im[i].selection.bottom );
+			sprintf( ch, " S%ld,%ld,%ld,%ld ",(long int) g->im[i].selection.left, (long int) g->im[i].selection.right,
+						       (long int) g->im[i].selection.top, (long int) g->im[i].selection.bottom );
 			strcat(line, ch);
 		}