/usr/share/doc/grub2-splashimages/commons2tga.pl is in grub2-splashimages 1.0.1+nmu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/usr/bin/perl
#
# grub2-commons2tga.pl by Krzysztof Burghardt <krzysztof@burghardt.pl>
#
# I, the copyright holder of this work, hereby release it into the
# public domain. This applies worldwide.
#
# In case this is not legally possible:
# I grant anyone the right to use this work for any purpose, without
# any conditions, unless such conditions are required by law.
#
use LWP::UserAgent;
use Image::Magick;
if ($#ARGV != 0) {
print "Usage: grub2-commons2tga commons_image_name.ext\n";
exit -1;
}
$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => "http://commons.wikimedia.org/wiki/Image:$ARGV[0]");
$req->header("Accept" => "text/html");
$res = $ua->request($req);
if ($res->is_success) {
$res = $res->content;
} else {
print "error: " . $res->status_line . "\n";
exit -1;
}
if ($res =~ /class="fullImageLink" id="file"><a href="([^"]*)"><img/si) {
$res = $1;
} else {
print "error: requested file not found on server\n";
exit -1;
}
$req = HTTP::Request->new(GET => $res);
$res = $ua->request($req);
if ($res->is_success) {
$res = $res->content;
} else {
print "error: " . $res->status_line . "\n";
exit -1;
}
$image = Image::Magick->new();
$image->BlobToImage($res);
$image->Scale(geometry => "640x480");
if ($ARGV[0] =~ /([^.]*)/g) {
$filename = "$1.tga";
$filename =~ s/ /_/g;
} else {
print "error: cannot determine target file name";
exit -1;
}
$image->Write(filename => $filename);
|