in reply to Resizing images && Tk

Since your code above looks a lot like something I did, I should point out the resize routine in my pic thresher application. You won't find any improvements to the resizing bit, but you may find it helpful in other ways.

My cursory tests indicate that the subsample argument is an integer deal. It seems it literally plucks out every nth pixel. There is a 'zoom' option in the $Photo->copy() method, which you might use to first enlarge the image, then shrink it back down. For instance, to get to 67% image size, you would zoom by 2 then subsample by 3. For 75%, zoom by 3, then subsample by 4. I've never had the urge to try this, as it seems like a guarantee for some ugly images. {grin} (not to mention the mental agony required to make a table of all these zoom/subsample ratios).

Tk::Photo also has a $Photo->get(x, y) method, which you could use to grab information about specific sets of pixels, then create new smaller sets of pixels from. So to get a 75% reduction grab a 4x4 "cell" from the image, then use your favorite algebraic formulas to compute corresponding values for a 3x3 "cell". Iterate until you have run out of cells. I'm guessing that using any of the other graphics modules would be more fun than this-- tempting as I'm sure the exercise sounds. Suggested module: GD.