ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
Subject: TeXutil image processing patch
Date: Mon, 15 Mar 2004 12:47:20 +0100	[thread overview]
Message-ID: <20040315124720.45a25b8f@glenlivet.elvenkind.com> (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 ) ;

             reply	other threads:[~2004-03-15 11:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-15 11:47 Taco Hoekwater [this message]
2004-03-15 21:09 ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040315124720.45a25b8f@glenlivet.elvenkind.com \
    --to=taco@elvenkind.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).