[Freeciv] Re: Rulesets, Tilesets, and Winblows
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, Sep 01, 2002 at 09:31:11PM +0200, akemnade@xxxxxxxxxxxxxxxxxxxxxxxx
wrote:
>
> On Sun, 1 Sep 2002 15:01:10 -0400
> Todd Goodman <tgoodman@xxxxxxxxxxxxx> wrote:
>
> > I can work on automating this and auto-generating pages.
> >
> It would be a big surprise to me, if you find a reliable way to convert the
> stuff automagically. I have had trouble during the conversion process today.
> Especially the nukes are often a problem.
> I have done a
>
> for name in *.xpm ; do convert $name $(echo $name | sed 's|xpm$|png|') ;
> done ;
>
> and then I tried
> file *.png
> and looked for files which do not show up as RGBA.
> I have opened the ones, which are not converted correctly, with gimp and
> saved them as pngs. Then again file *.png.
Brr ...
What I've done myself is start on a script to convert the flags.xpm to
different sizes. They turn out to be very irregular. The parsing script
is attached, but to do it robustly a different approach is required:
read the image into memory, find the smallest enclosing rectangles that
do not contain redundant rows or columns in the background colour, generate
the specs from the result. The same can be done for the other .xpm files,
and conversion from/to .png is trivial to add. One way to implement
it is with Perl's Image::Magick. But it keeps lingering on my todo list.
> And finally
>
> for name in *.png ; do mv $name $name.bak ; pngquant 256 <$name.bak >$name ;
> done
>
> And a final look at them (with freeciv). Cleanup:
> rm *.xpm
> rm *.bak
> Then I have created the tarball.
>
> I have planned to write a script which can build freeciv from source, convert
> the gfx, and build the zip archive but in the end I have a tarball with the
> png files and extract them after I have build freeciv for windows (no
> auto-converting of gfx).
OK.
> All tilesets are converted now. I have moved the files to the right place
> except for the directories owned by rp.
> rp: can you update the files in that directories?
Sorry, I forgot to turn g+w permission on. Done.
Thank you very much!
> Greetings
> Andreas Kemnade
--
Reinier
-- Attached file included as plaintext by Ecartis --
#!/usr/bin/env perl
#
# flag - select a flag from a Freeciv flag file
use strict;
use warnings;
my @args = @ARGV;
my @opts = ();
while (@args && $args[0] =~ /^-/)
{
push(@opts, shift(@args));
}
die "$0: supply two positive numbers as arguments\n" if !@args;
my $x = shift @args;
die "$0: supply two positive numbers as arguments\n" if !@args;
my $y = shift @args;
my $input = @args ? shift @args : '-';
my $tilesetsize = 30;
map { /^-(\d+)/ and $tilesetsize = $1 } @opts;
die "$0: you must supply two numbers as arguments\n"
if !length $x || !length $y || "$x$y" =~ /\D/;
my ($xsize, $ysize, $xmargin, $ymargin, $xbetween, $ybetween) =
$tilesetsize eq 20 ?
(17, 14, 0, 0, 20, 20) # for a 20x20 tileset flags.xpm
:
(30, 24, 17, 9, 64, 48); # for a 30x30 tileset flags.xpm
@args = (
'convert',
'-colors', '256',
'-crop' ,
do { $_ =
sprintf('%dx%d+%d+%d',
$xsize, $ysize,
$xmargin + $xbetween * $x,
$ymargin + $ybetween * $y);
s/\+-/-/g;
$_;
},
$input,
'ppm:-'
);
warn join ' ', @args, "\n";
# we postprocess through ppmtoxpm(1), otherwise xv(1) can't display the result
# using a safe pipe, see perldoc perlipc
open(PPM, '-|') || exec { 'convert' } @args;
open(XPM, '|-') || exec { 'ppmtoxpm' } 'ppmtoxpm';
print XPM <PPM>;
close XPM;
close PPM;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv] Re: Rulesets, Tilesets, and Winblows,
Reinier Post <=
|
|