Changeset 2032


Ignore:
Timestamp:
Nov 20, 2007, 12:04:35 AM (13 years ago)
Author:
Sam Hocevar
Message:
  • Use Image.copyTo() and Image.getCrop() instead of pixel-by-pixel operations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/study/study.py

    r2031 r2032  
    817817    for y in range(sh):
    818818        for x in range(sw):
    819             tmp = Image((tnw, tnh), True)
    820             for j in range(tnh):
    821                 for i in range(tnw):
    822                     rgb = src.getRgb(x * tnw + i, y * tnh + j)
    823                     tmp.setRgb(i, j, *rgb)
    824             thumbs.append(tmp)
     819            thumbs.append(src.getCrop(x * tnw, y * tnh, tnw, tnh))
    825820    random.shuffle(thumbs)
    826821    return thumbs
     
    850845        di = 8 + (n % dw) * (tnw + 8)
    851846        dj = 8 + (n / dw) * (tnh + 8)
    852         for y in range(tnh):
    853             for x in range(tnw):
    854                 (r, g, b) = img.getRgb(x, y)
    855                 dest.setRgb(di + x, dj + y, r, g, b)
     847        img.copyTo(dest, (di, dj))
    856848    return dest
    857849
Note: See TracChangeset for help on using the changeset viewer.