Jump to content
  • Advertisement
Sign in to follow this  
REspawn

Scaling textures to create thumbnails

This topic is 2779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I have been searching around for tutorials / docs on scaling textures. Is the only way to scale a texture to use render targets?

I'd like to create small thumbnails of textures to save out as a JPG. Is there an easy way to achieve this without render targets?




Thanks for any help,

Dave

Share this post


Link to post
Share on other sites
Advertisement
You can do it however you want, using whatever library you want. GDI+ can do it very easily, or you can use ImageMagick, or you can use D3DX helper functions. You can use D3DXCreateTextureFromFileEx and specify the thumbnail size and it will scale it down for you, or you can use D3DXLoadSurfaceFromSurface to scale down an existing texture. Or if you generated mipmaps for your texture, you can just grab the surface from a lower mip level and use D3DXSaveSurfaceToFile.

Share this post


Link to post
Share on other sites

You can do it however you want, using whatever library you want. GDI+ can do it very easily, or you can use ImageMagick, or you can use D3DX helper functions. You can use D3DXCreateTextureFromFileEx and specify the thumbnail size and it will scale it down for you, or you can use D3DXLoadSurfaceFromSurface to scale down an existing texture. Or if you generated mipmaps for your texture, you can just grab the surface from a lower mip level and use D3DXSaveSurfaceToFile.


Thanks, I'll check those functions out and see if I can get something working.

Update: Both methods worked perfectly. I went with D3DXLoadSurfaceFromSurface in the end. Thanks again for the help.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!