Last change
on this file since 83 was
83,
checked in by David Sheldon, 14 years ago
|
Some of the scripts used to sort out tiling the maps.
|
-
Property svn:executable set to
*
|
File size:
1.0 KB
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | #my $mode = "rectangle"; |
---|
4 | my $mode = "thumb"; |
---|
5 | |
---|
6 | |
---|
7 | use Image::Magick; |
---|
8 | |
---|
9 | my $out = Image::Magick->new(size => '700x700'); |
---|
10 | |
---|
11 | $out ->ReadImage('xc:white'); |
---|
12 | |
---|
13 | open FH, "<corners.csv" or die "Can't open corners $!"; |
---|
14 | |
---|
15 | while(<FH>) { |
---|
16 | chomp; |
---|
17 | ($tile, $x, $y) = split /,/, $_; |
---|
18 | my ($x1, $y1) = ($x, $y); |
---|
19 | my ($x2, $y2) = ($x+39, ($y-44)); |
---|
20 | |
---|
21 | print "$x,$y2,$x2,$y\n"; |
---|
22 | |
---|
23 | if (($mode eq "rectangle") || (! -f (glob "${tile}_*.jpg")[0])) { |
---|
24 | print $out->Draw(primitive => 'rectangle', fill => 'red', points =>"$x1,$y1,$x2,$y2"); |
---|
25 | } else { |
---|
26 | if (! -f "thumbs/${tile}.jpg") { |
---|
27 | my $in = Image::Magick->new(); |
---|
28 | $in -> Read((glob "${tile}_*.jpg")[0]); |
---|
29 | $in -> Sample("160x180"); |
---|
30 | $in -> Write("jpg:thumbs/${tile}.jpg"); |
---|
31 | } |
---|
32 | my $in = Image::Magick->new(); |
---|
33 | $in -> Read("thumbs/${tile}.jpg"); |
---|
34 | $in -> Sample("40x45"); |
---|
35 | $in->Flip(); |
---|
36 | print $out->Composite(image=>$in, x=>$x1, y=>$y2); |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | close FH; |
---|
41 | |
---|
42 | $out->Flip(); |
---|
43 | print $out->Write("jpg:thumbnail.jpg") ; |
---|
Note: See
TracBrowser
for help on using the repository browser.