1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
3 | # cfarch2png - convert crossfire maps to png+metadata |
3 | # cfarch2png - convert crossfire maps to png+metadata |
4 | # Copyright (C) 2005 Marc Lehmann <gvpe@schmorp.de> |
4 | # Copyright (C) 2005,2007 Marc Lehmann <cfmaps@schmorp.de> |
5 | # |
5 | # |
6 | # CFARCH2PNG is free software; you can redistribute it and/or modify |
6 | # CFARCH2PNG is free software; you can redistribute it and/or modify |
7 | # it under the terms of the GNU General Public License as published by |
7 | # it under the terms of the GNU General Public License as published by |
8 | # the Free Software Foundation; either version 2 of the License, or |
8 | # the Free Software Foundation; either version 2 of the License, or |
9 | # (at your option) any later version. |
9 | # (at your option) any later version. |
… | |
… | |
28 | # Bottom object: the highest object that is a floor type object. |
28 | # Bottom object: the highest object that is a floor type object. |
29 | # |
29 | # |
30 | # ... i believe that anytime, but it still doesn't mention the smoothlevel |
30 | # ... i believe that anytime, but it still doesn't mention the smoothlevel |
31 | # interaction :( |
31 | # interaction :( |
32 | |
32 | |
33 | our $VERSION = '1.21'; |
33 | our $VERSION = '1.211'; |
34 | |
34 | |
35 | use strict; |
35 | use strict; |
36 | |
36 | |
37 | use Storable; |
37 | use Storable; |
38 | use List::Util qw(max); |
38 | use List::Util qw(max); |
… | |
… | |
385 | ($map_pb, \%meta) |
385 | ($map_pb, \%meta) |
386 | } |
386 | } |
387 | |
387 | |
388 | for my $file (@ARGV) { |
388 | for my $file (@ARGV) { |
389 | my $mapa = read_arch $file; |
389 | my $mapa = read_arch $file; |
|
|
390 | $file =~ s/\.map$//; |
390 | my ($pb, $meta) = cfmap_render $mapa, $file; |
391 | my ($pb, $meta) = cfmap_render $mapa, $file; |
391 | $pb->save ("$file.png~~", "png"); |
392 | $pb->save ("$file.png~~", "png"); |
392 | system "gm", "convert", "$file.png~~", "-filter" => "lanczos", "-geometry" => "3.125%", "-quality" => 85, "$file.jpg"; |
393 | system "gm", "convert", "$file.png~~", "-filter" => "lanczos", "-geometry" => "3.125%", "-quality" => 85, "$file.jpg"; |
393 | #system "mogrify", "-colors" => 65536, "$file.png~"; # destroys transparency |
394 | #system "mogrify", "-colors" => 65536, "$file.png~"; # destroys transparency |
394 | system "pngcrush", "-q", "-m" => 7, "-rem", "alla", "-cc", "-reduce", "$file.png~~", "$file.png~"; |
395 | system "pngcrush", "-q", "-m" => 7, "-rem", "alla", "-cc", "-reduce", "$file.png~~", "$file.png~"; |