* TeXutil image processing patch
@ 2004-03-15 11:47 Taco Hoekwater
2004-03-15 21:09 ` Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Taco Hoekwater @ 2004-03-15 11:47 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 345 bytes --]
Hi all,
Attached is a patch that fixes the image file scanners in texutil 8.1
Changes:
- Version = 8.1f
- Fix "--verbose" offset reporting
- Fix TIF Author/Title/Creator discovery
- Fix PNG Author/Title/Creator discovery
- Support TIF Unit type "1 to 1" (uses 72dpi)
- Fix JPG images with broken resolutions (uses 72dpi)
--
groeten,
Taco
[-- Attachment #2: texutil-81-figures.patch --]
[-- Type: application/octet-stream, Size: 2604 bytes --]
--- texutil.pl.81 2004-03-15 12:37:02.699383701 +0100
+++ texutil.pl 2004-03-15 12:40:01.039813613 +0100
@@ -40,7 +40,7 @@
#D binary version, like scanning illustrations other than \EPS.
#D I would suggest to keep an eye on the version number:
-$Program = "TeXUtil 8.1 - ConTeXt / PRAGMA ADE 1992-2003" ;
+$Program = "TeXUtil 8.1f - ConTeXt / PRAGMA ADE 1992-2003" ;
#D By the way, this is my first \PERL\ script, which means
#D that it will be improved as soon as I find new and/or more
@@ -2011,7 +2011,7 @@
if ($FUni)
{ print "n=$FNam t=$FTyp " .
(sprintf "x=%1.3fcm y=%1.3fcm ", $FXof, $FYof) .
- (sprintf "w=%1.3fcm h=%1.3fcm\n", $FWid, $FHei) }
+ (sprintf "w=%5.3fcm h=%5.3fcm\n", $FWid, $FHei) }
else
{ print "n=$FNam t=$FTyp " .
"x=${FXof}bp y=${FYof}bp " .
@@ -2245,9 +2245,9 @@
return $N/$M }
sub TifGetAscii
- { my ($S) = "" ;
+ { my $S = "" ;
--$TifValues;
- if ($TifValues)
+ unless ($TifValues)
{ return "" }
else
{ read TIF, $S, $TifValues ;
@@ -2333,8 +2333,10 @@
while (TifGetChunk) { }
if ($TifUnit==2)
{ $TifMult = $INtoCM }
- else
+ elsif ($TifUnit==3)
{ $TifMult = 1 }
+ else
+ { $TifMult = 72 }
$TifWidth = ($TifWidth /$TifHRes)*$TifMult ;
$TifHeight = ($TifHeight/$TifVRes)*$TifMult ;
close ( TIF ) ;
@@ -2384,14 +2386,14 @@
$PngVRes = PngGetLong ;
read PNG, $PngUnit, 1 }
elsif ($PngType eq "tEXt")
- { read PNG, $PngKeyword, 79 ;
- read PNG, $PngDummy, 1 ;
+ { read PNG, $PngKeyword, $PngLength;
+ ($PngKeyword,$PngDummy) = split(/\x00/,$PngKeyword);
if ( $PngKeyword eq "Title")
- { read PNG, $PngTitle, $Length }
+ { $PngTitle = $PngDummy }
elsif ( $PngKeyword eq "Author")
- { read PNG, $PngAuthor, $PngLength }
+ { $PngAuthor = $PngDummy }
elsif ( $PngKeyword eq "Software")
- { read PNG, $PngCreator, $PngLength } }
+ { $PngCreator = $PngDummy } }
return 1 }
else
{ return 0 } }
@@ -2511,6 +2513,8 @@
{ $JpgMult = $INtoCM }
else
{ $JpgMult = 1 }
+ $JpgHRes = 72 unless $JpgHRes>1;
+ $JpgVRes = 72 unless $JpgVRes>1;
$JpgWidth = ($JpgWidth/$JpgHRes)*$JpgMult ;
$JpgHeight = ($JpgHeight/$JpgVRes)*$JpgMult ;
close ( JPG ) ;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: TeXutil image processing patch
2004-03-15 11:47 TeXutil image processing patch Taco Hoekwater
@ 2004-03-15 21:09 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2004-03-15 21:09 UTC (permalink / raw)
Hi Taco,
>- Version = 8.1f
8.2 now
>- Fix "--verbose" offset reporting
>- Fix TIF Author/Title/Creator discovery
>- Fix PNG Author/Title/Creator discovery
>- Support TIF Unit type "1 to 1" (uses 72dpi)
>- Fix JPG images with broken resolutions (uses 72dpi)
ok, patched; when i wrote that code it was quite an experience to do the
binary reads in perl; can you believe that i've forgotten most of what i
did then; lucky me that you're a better spec reader -)
Hans
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-03-15 21:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-15 11:47 TeXutil image processing patch Taco Hoekwater
2004-03-15 21:09 ` Hans Hagen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).