... | ... |
@@ -6,7 +6,7 @@ |
6 | 6 |
* |
7 | 7 |
* History: |
8 | 8 |
* 1/07/2019 Creation |
9 |
- * 5/11/2019 Fix erroneous 1-pixel border around every tile |
|
9 |
+ * 5/11/2019 Fix erroneous 1-pixel border around every tile |
|
10 | 10 |
* |
11 | 11 |
* Author: Dario Rodriguez dario@softhome.net |
12 | 12 |
* This program is distributed under the terms of the GNU GPL v2.1+ |
... | ... |
@@ -16,7 +16,7 @@ int |
16 | 16 |
main(int argc, array(string) argv) |
17 | 17 |
{ |
18 | 18 |
int a4w,a4h; |
19 |
- int maxx,maxy; |
|
19 |
+ int maxx,maxy; |
|
20 | 20 |
int px,py; |
21 | 21 |
string destfilename; |
22 | 22 |
int total; |
... | ... |
@@ -30,30 +30,30 @@ main(int argc, array(string) argv) |
30 | 30 |
a4w=(int)argv[1]; |
31 | 31 |
a4h=(int)argv[2]; |
32 | 32 |
destfilename=argv[sizeof(argv)-1]; |
33 |
- array(string) infiles=argv[3..sizeof(argv)-2]; |
|
34 |
- maxx=maxy=1; |
|
35 |
- write("* Calculating tile size\n"); |
|
36 |
- foreach(infiles, string f) { |
|
37 |
- img=Image.load(f); |
|
38 |
- if(img->xsize()>maxx) |
|
39 |
- maxx=img->xsize(); |
|
40 |
- if(img->ysize()>maxy) |
|
41 |
- maxy=img->ysize(); |
|
42 |
- } |
|
43 |
- result=Image.Image(maxx*a4w,maxy*a4h,255,255,255); |
|
44 |
- px=py=0; |
|
45 |
- total=0; |
|
46 |
- foreach(infiles, string f) { |
|
47 |
- write("* Processing "+f+"...\n"); |
|
48 |
- img=Image.load(f); |
|
49 |
- result->paste(img,px*(maxx),py*(maxy)); |
|
50 |
- px++; |
|
51 |
- if(px>=a4w) { |
|
52 |
- px=0; |
|
53 |
- py++; |
|
54 |
- } |
|
55 |
- total++; |
|
56 |
- } |
|
33 |
+ array(string) infiles=argv[3..sizeof(argv)-2]; |
|
34 |
+ maxx=maxy=1; |
|
35 |
+ write("* Calculating tile size\n"); |
|
36 |
+ foreach(infiles, string f) { |
|
37 |
+ img=Image.load(f); |
|
38 |
+ if(img->xsize()>maxx) |
|
39 |
+ maxx=img->xsize(); |
|
40 |
+ if(img->ysize()>maxy) |
|
41 |
+ maxy=img->ysize(); |
|
42 |
+ } |
|
43 |
+ result=Image.Image(maxx*a4w,maxy*a4h,255,255,255); |
|
44 |
+ px=py=0; |
|
45 |
+ total=0; |
|
46 |
+ foreach(infiles, string f) { |
|
47 |
+ write("* Processing "+f+"...\n"); |
|
48 |
+ img=Image.load(f); |
|
49 |
+ result->paste(img,px*(maxx),py*(maxy)); |
|
50 |
+ px++; |
|
51 |
+ if(px>=a4w) { |
|
52 |
+ px=0; |
|
53 |
+ py++; |
|
54 |
+ } |
|
55 |
+ total++; |
|
56 |
+ } |
|
57 | 57 |
write("* Writing "+destfilename+"...\n"); |
58 | 58 |
Stdio.write_file(destfilename,Image.PNG.encode(result)); |
59 | 59 |
write("tiled "+total+" images into "+destfilename+". Process finished.\n"); |