#! / usr / bin / perl
$ Identify = "/ usr / local / imagemagick / bin / identify";
$ convert = "/ usr / local / imagemagick / bin / convert";
$ Composite = "/ usr / local / imagemagick / bin / composite";
$ condir = "./pics"; # source path
$ objcdir = "./picd"; # Target path
$ TMP = "/tmp/.conv.tmp";
$ white = "/Root/white.jpg";
OpenDir (OD, $ condir);
@ allds = readdir od;
CloseDir OD;
Foreach $ alldf (@Allds) {
IF ($ alldf ne "." && $ alldf ne "..") {
SYSTEM ("$ Convert $ Convdir / $ ALDF -RESIZE 100X100 $ TMP");
Open (SO, $ Identify $ TMP |);
$ allso =
Close SO;
@ alls = split (/ /, $ allso);
@ wh = split (/ x /, $ alls [2]);
$ WH [1] = ~ s // [0-9] //g;
IF ($ WH [0]> $ WH [1]) {
$ OFFSET = (100- $ WH [1]) / 2;
System ($ Composite -Geometry 0 $ Offset $ TMP $ White $ ObjcDir / $ alldf ");
} else {
$ OFFS = (100- $ WH [0]) / 2;
SYSTEM ($ Composite -Geometry $ Offset 0 $ TMP $ White $ ObjcDir / $ ALLDF ");
}
}
}
The role of this code is to convert all the pictures in the Source Path, convert all the thumbnail images of no more than 100x100, then add the background (White.jpg), save in the "Target path"
The key is this: GIF source map is reduced or dynamic
Convert 1-8-51-32-357532324.gif -resize 50x50 YSL.GIF