version 1.4, 2004/11/18 20:10:17
|
version 1.6, 2004/12/06 10:02:54
|
Line 24 use MPIWGlib;
|
Line 24 use MPIWGlib;
|
|
|
$| = 1; # unblock IO |
$| = 1; # unblock IO |
|
|
my $version = "V0.9.3 (ROC 18.11.2004)"; |
my $version = "V0.9.4 (ROC 6.12.2004)"; |
|
|
$debug = 0; |
$debug = 0; |
|
|
Line 41 my $overwrite = 0; # overwrite already c
|
Line 41 my $overwrite = 0; # overwrite already c
|
|
|
# image file extensions and formats |
# image file extensions and formats |
my %img_type_ext = ("tif" => "TIFF", "tiff" => "TIFF", "gif" => "GIF", |
my %img_type_ext = ("tif" => "TIFF", "tiff" => "TIFF", "gif" => "GIF", |
"jpg" => "JPEG", "png" => "PNG"); |
"jpg" => "JPEG", "png" => "PNG", "dcr" => "RAW"); |
# destination image file extensions |
# destination image file extensions |
my %target_ext_type = ("TIFF" => "jpg", "JPEG" => "jpg"); |
my %target_ext_type = ("TIFF" => "jpg", "JPEG" => "jpg"); |
|
|
Line 130 sub findfile {
|
Line 130 sub findfile {
|
return; |
return; |
} |
} |
|
|
|
# |
|
# $p = cleanpath($path, $startslash). |
|
# |
|
# returns a pathname with trailing and starting slash removed (if |
|
# $startslash is true the starting slash is not removed) |
|
# |
sub cleanpath { |
sub cleanpath { |
my ($path, $startslash) = @_; |
my ($path, $startslash) = @_; |
|
|
if ($path =~ /^(\/)*(.*?)\/*$/) { |
if ($path =~ /^(\/)*(.*?)\/*$/) { |
if ($startslash) { |
if ($startslash) { |
print "$path --> $1$2\n"; |
|
return $1 . $2; |
return $1 . $2; |
} else { |
} else { |
print "$path --> $2\n"; |
|
return $2; |
return $2; |
} |
} |
} |
} |
print "hä? $path\n"; |
|
return $path; |
return $path; |
} |
} |
|
|
Line 635 sub convert_file {
|
Line 637 sub convert_file {
|
# |
# |
$pictype = quickident("$srcdir/$filename"); |
$pictype = quickident("$srcdir/$filename"); |
if ($pictype) { |
if ($pictype) { |
|
if ($pictype eq "RAW") { |
|
logger('DEBUG', "skipping raw file '$srcdir/$filename'"); |
|
return 0; |
|
} |
my $newext = $target_ext_type{$pictype}; |
my $newext = $target_ext_type{$pictype}; |
if ($newext) { |
if ($newext) { |
$newfn = $filebase . ".$newext"; |
$newfn = $filebase . ".$newext"; |
Line 651 sub convert_file {
|
Line 657 sub convert_file {
|
} |
} |
} else { |
} else { |
# quick ident failed -- do it slowly |
# quick ident failed -- do it slowly |
|
|
($pictype, $picwidth, $picheight, $bitdepth) = identify("$srcdir/$filename"); |
($pictype, $picwidth, $picheight, $bitdepth) = identify("$srcdir/$filename"); |
if ((! $pictype)||($picwidth == 0)||($picheight == 0)) { |
if ((! $pictype)||($picwidth == 0)||($picheight == 0)) { |
logger('WARNING', "unknown file type '$srcdir/$filename'"); |
logger('WARNING', "unknown file type '$srcdir/$filename'"); |