User:Ronhjones/ResizerTest
Appearance
File:Everybody's Fool (Evanescence single - cover art).jpg is 471 × 415 pixels
in littleimage.py, routine gimme_image and about 24 lines down, it works out the size... (print statements are mine)
img = Image.open(item10)
print "img.size[0]", img.size[0]
print "img.size[1]", img.size[1]
basewidth = int(math.sqrt((pxl * float(img.size[0]))/(img.size[1])))
print "basewidth",basewidth
wpercent = (basewidth/float(img.size[0]))
print "wpercent",wpercent
hsize = int((float(img.size[1])*float(wpercent)))
print "hsize",hsize
original_pixel = img.size[0] * img.size[1]
print "original_pixel",original_pixel
modified_pixel = basewidth * hsize
print "modified_pixel",modified_pixel
pct_chg = 100.0 * (original_pixel - modified_pixel) / float(original_pixel)
print "pct_chg",pct_chg
if pct_chg > 5:
png_info = img.info
img = img.resize((int(basewidth),int(hsize)), Image.ANTIALIAS)
img.save(filename + extension, **png_info)
else:
print "Looks like we'd have a less than 5% change in pixel counts. Skipping."
results = "PIXEL"
return results
The result of the prints are below
img.size[0] 336 img.size[1] 296 basewidth 336 wpercent 1.0 hsize 296 original_pixel 99456 modified_pixel 99456 pct_chg 0.0 Looks like we'd have a less than 5% change in pixel counts. Skipping. Removing tag...already reduced...
So a picture of 471 × 415 pixels is being decoded as 336 x 296 pixels. Either the calls are wrong or this is a BAD file - it's old enough to be in the area where I seem to recall there was a massive image problem. The bot may be OK, the image might be at fault.
Ron.