]> thyrsus.com Git - imgsizer.git/commitdiff
Analyze jpgs
authorEric S. Raymond <esr@thyrsus.com>
Mon, 30 Jul 2001 05:04:45 +0000 (05:04 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 30 Jul 2001 05:04:45 +0000 (05:04 +0000)
imgsizer

index f94d109fd764e0d1599e32426eb6d9ac9bcb476d..8063b60b8520ad33add17a9adf3c7080461d7eb3 100755 (executable)
--- a/imgsizer
+++ b/imgsizer
 #    try commands in least to most expensive order, and notice when a command
 #    returns not to try it again.
 #
+# Fixes by ESR, 29 July 2001
+#
+#    Incorporated fixes by Peter S. Galbraith.
+#
 import sys, os, getopt, cmp, string, re, urllib, commands
 
 version = "2.1, 26 July 2001";
@@ -122,8 +126,8 @@ def sizefix(infp, outfp):
                 attributes = attributes + ch
             outfp.write(transform(attributes) + ">")
 
-x_match = re.compile (r" ([0-9]+) *x *([0-9]+) ")
-rdjpg_match = re.compile (r" ([0-9]+)w *\* *([0-9]+)h ")
+x_match = re.compile (r" ([0-9]+) *x *([0-9]+)")
+rdjpg_match = re.compile (r" ([0-9]+)w *\* *([0-9]+)h")
 
 def imgsize(src):
     "Return the image size in pixels for a given image source."
@@ -143,7 +147,7 @@ def imgsize(src):
                 return (sizes.group(1), sizes.group(2))
         elif rdjpgcom:
             # Use rdjpcom(1) to handle JPEGs
-            (status, output) = commands.getstatusoutput("rdjpcom " + filename)
+            (status, output) = commands.getstatusoutput("rdjpgcom -verbose " + filename)
             sizes = rdjpg_match.search(output)
             if sizes:
                 return (sizes.group(1), sizes.group(2))