Sign in to follow this  

Texture resampling

Recommended Posts

I don't have any experience with this--but here's an idea. For each pixel in your destination image, you have 8*8 pixels in the source image. You should average the color values of these 64 pixels to get the color value of the destination pixel.

So you'd loop through the pixels like this (for the first row):

unsigned char outcolor[3];

for (int i = 0; i < width; i += 8)
for (int j = 0; j < 8; j++)
// get color values for the [i+j]th pixel and add to output color

// divide values in output color by 64.

I don't know, but maybe this is what is linear interpolation. [smile] A google should yield results though, or as a final resort, check the gimp source for scaling images.

/edit: fixed the increment in the inner loop

[Edited by - deavik on November 26, 2005 2:44:44 AM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this