# from arclayer.py srcRgn = layer.get_pixel_rgn(0, 0, w, h, False, False) src_pixels = array("B", srcRgn[0:srcWidth, 0:srcHeight]) dstRgn = destDrawable.get_pixel_rgn(0, 0, w, w, True, True) p_size = len(srcRgn[0,0]) dest_pixels = array("B", "\x00" * (w * h * p_size)) # Loop over the region: for x in xrange(0, srcWidth - 1) : for y in xrange(0, srcHeight) : newval = src_pixels[src_pos: src_pos + p_size] dest_pixels[dest_pos : dest_pos + p_size] = newval gimp.progress_update(float(x)/layer.width) # Copy the whole array back to the pixel region: dstRgn[0:newWidth, 0:newHeight] = dest_pixels.tostring() dstDrawable.flush() dstDrawable.merge_shadow(TRUE) dstDrawable.update(0, 0, newwidth, newheight)