[greenstone-users] Imagemagik and file sizes

From Diego Spano
DateWed Apr 9 09:51:03 2008
Subject [greenstone-users] Imagemagik and file sizes
Hi List, just a simple question:

Imagemagik has different behaviour in Windows and Linux that is reflected in
ImageSize extracted metadata.

If you run "identify photo1.jpg" in Windows, Imagemagik gives the following
info:

photo1.jpg JPEG 2086x1399 2086x1399+0+0 DirectClass 8-bit 336.08kb 0.234u
0:01


So, [ImageSize] will be 344064 because ImagePlug multiply that value by
1024.


If you run "identify photo1.jpg" in Linux, Imagemagik gives the following
info:

photo1.jpg JPEG 2086x1399 2086x1399+0+0 DirectClass 3.4e+02kb

So, [ImageSize] will be "Unknown" because ImagePlug will try to multiply
3.4e+02 by 1024. It is a problem of format. The solution will be to change
ImagePlug where it has:


# Read the size
my $size = "unknown";
if ($result =~ m/^.* ([0-9]+)b/) {
$size = $1;
}
elsif ($result =~ m/^.* ([0-9]+)(.([0-9]+))?kb?/) {
$size = 1024 * $1;
if (defined($2)) {
$size = $size + (1024 * $2);
# Truncate size (it isn't going to be very accurate anyway)
$size = int($size);
}
}

to something that check size notation and do the correct operations. I think
it should be easy to somebody who knows Perl. Is there anybody that can do
this?

TIA

Diego J. Spano
Direcci?n General de Gesti?n Inform?tica
Ministerio de Justicia, Seg. y DD. HH.
Tel.: 4328.3015 (int.1404)
4322.6122 (directo)
Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://list.scms.waikato.ac.nz/mailman/private/greenstone-users/attachments/20080408/6ba73afe/attachment.html