From: Eric S. Raymond Date: Mon, 30 Jul 2001 05:04:45 +0000 (+0000) Subject: Analyze jpgs X-Git-Tag: 2.2~2 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=10e1de4fe3084fd313171a11ace8d21e0cc2427d;p=imgsizer.git Analyze jpgs --- diff --git a/imgsizer b/imgsizer index f94d109..8063b60 100755 --- a/imgsizer +++ b/imgsizer @@ -53,6 +53,10 @@ # 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))