[Clipart] transparent turkeys

Stephen Silver ocalocal at btinternet.com
Sat Jan 29 10:03:00 PST 2005


Jon Phillips wrote:

> Man, I almost forgot about this task. Do you all think we can fix them all b4 
> the release on MONDAY if we use those quick scripts we passed around and some 
> visual checking, or should I add this task to next month's roadmap?

I've tested Jonadab's Perl script (with some changes - see below) and I don't
see any problems.  So I think this can be used now, and there's no need to
wait until next month.

Here's the script that I actually tested.  This incorporates the change
I previously suggested (to handle the more general case) and fixes the
syntax error on that line (missing semicolon) and uses "use strict" and
is formatted differently, but is otherwise the same as the one Jonadab
originally posted.


use strict;

sub fix {
    my ($dir) = @_;
    my $f;
    for $f (<$dir/*>) {
        if (-d $f) { fix($f); }
        elsif ($f =~ /svg$/i) {
            open SVG, "<", $f;
            open TMP, ">", "temp";
            my $line=0;
            while (<SVG>) {
                ++$line;
                if (/fill:url/) {
                    s/fill-opacity:0[.0-9]*;/fill-opacity:1;/g;
                    print "$f line $line\n";
                }
                print TMP $_;  }
            close SVG;
            close TMP;
            `mv temp $f`;
        }
    }
}

fix("openclipart-0.09");


-- 
Stephen Silver




More information about the clipart mailing list