Like JR2003 said, a quick and dirty way to do it is to average.
for all i,j in the dest raster:
dest[i][j].r = (src[2*i][2*j].r + src[2*i+1][2*j].r + src[2*i][2*j+1].r + src[2*i+1][2*j+1].r)/4
and the same for the g and b planes
It gets a little more complex if there is an alpha channel.
Main Topics
Browse All Topics





by: JR2003Posted on 2009-09-18 at 07:53:39ID: 25366607
You can take the average of each of the RGB values for each block of 4 cells (2 horizontal and 2 vertical).