[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Including scalable icons to improve size coverage



Matthias Clasen wrote:
It would be very valuable if someone could work on a little script to get rid of the thumbnails and the illustrator-specific stuff. That should allow us to shrink the svgs _a lot_ and make it possible to
include them in the package, which is not possible as things stand right
now.

I wrote the script you asked for. It removes the following elements:
i:pgf (where the ID is "adobe_illustrator_pgf"), i:pgfRef and x:xmpmeta. Attached is a trimmed version of one of the icons (416k to 18k) . People should check it works on their svg tool before you start compressing icons.
#!/usr/bin/perl

use XML::Twig;

  my $twig=XML::Twig->new(twig_handlers => {
        'i:pgf' => sub {
            if ($_->{'att'}->{'id'} eq 'adobe_illustrator_pgf'){
                $_->delete;
            }
        },
        'i:pgfRef' => sub {
            $_->delete;
        },
        'x:xmpmeta' => sub {
            $_->delete;
        },
        
    }
  
  );    # create the twig
  $twig->parsefile('-');        # build it
  $twig->print;                 # output the twig

image/svg


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]