making smaller textures from a big texture

Started by
1 comment, last by Ashaman73 14 years, 2 months ago
hi friends I use VS2008, I have some big textures (around 6000 x 6000 pixels or even larger), they are in BMP or JPG format, how can I divide them to several smaller textures, for instances I want to change my 6000x6000 BMP to 10x10 = 100 textures with 600x600 size, how can I perform it? any suggestion? thanks in advance, any tips or samples would be highly appreciated
Visit galaxyroad.com which soon will have english contents too
Advertisement
I think you'r thinking too much about programming. You can get this functionality from a photo editting tool like Photoshop. The "slice tool" will do exactly the thing you want.

If, however, you have been asked to do this for a project purely using programming then first you need to load your picture into a structure. Once it is in the structure this is just a looping problem. The pixels will be stored in an array of sorts, you just need to pull out the ones you want.

The solution would look like this:

for(y=0; y<height; y++)
{
for(x=0; x<width; x++)
{
savePixel(); // This would save the current pixel to a new structure
}
}

This is assuming a 2d array in you picture structure.

Hope I have understood the problem and helped a little.
Quote:Original post by vcGamer
hi friends
I use VS2008, I have some big textures (around 6000 x 6000 pixels or even larger), they are in BMP or JPG format, how can I divide them to several smaller textures, for instances I want to change my 6000x6000 BMP to 10x10 = 100 textures with 600x600 size, how can I perform it? any suggestion?

thanks in advance, any tips or samples would be highly appreciated


Take a look at imagemagick, it's a command line image processing tool. You can write a little script or .bat file to let the tool extract certain regions of your source file and save it to your target texture.

This topic is closed to new replies.

Advertisement