bug-gnupod
[Top][All Lists]
Advanced

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

[Bug-gnupod] Do not stretch artwork


From: Richard van den Berg
Subject: [Bug-gnupod] Do not stretch artwork
Date: Sun, 14 Jun 2009 23:06:02 +0200
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)

I might still convert the artwork generation to Image::Magick, but in the meantime here is a patch to not distort the artwork to a square. Instead the aspect is preserved, and white bands are added (left + right or top + bottom) when needed.

Cheers,

Richard
Index: src/ext/ArtworkDB.pm
===================================================================
RCS file: /sources/gnupod/gnupod/src/ext/ArtworkDB.pm,v
retrieving revision 1.22
diff -u -r1.22 ArtworkDB.pm
--- src/ext/ArtworkDB.pm        5 Jun 2009 12:55:56 -0000       1.22
+++ src/ext/ArtworkDB.pm        14 Jun 2009 21:02:16 -0000
@@ -174,7 +174,7 @@
                $self->{fbimg}->{source_size} = (-s $file) or return 0; # no 
thanks
                foreach my $mr (@$mode) {
                        my $buff = '';
-                       open(IM, "-|") || exec("convert", "-resize", 
"$mr->{height}x$mr->{width}!", "-depth", 8, $file, "RGB:-");
+                       open(IM, "-|") || exec("convert", "-resize", 
"$mr->{height}x$mr->{width}", 
"-background","white","-gravity","center","-extent","$mr->{height}x$mr->{width}",
 "-depth", "8", $file, "RGB:-");
                        binmode(IM);
                        while(<IM>) { $buff .= $_  }
                        close(IM);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]