Sign in to follow this  
vcGamer

making smaller textures from a big texture

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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