Get conents of TextureData into an BufferedImage

Hi all!

My app stores all its textures as TextureData. Now I would like to convert some of these TextureDatas back into ordinary BufferedImages in order to be able to print them.
But I don’t know how to handle the different imageTypes:


public BufferedImage texDataToBufferedImage(TextureData tex){
    BufferedImage bi = new BufferedImage(tex.getWidth(), tex.getHeight, ???);
}

The contructor needs the imageType, but the TextureData class only provides the following


tex.getInternalFormat()
tex.PixelFormat()
tex.getPixelType()

Which one should I choose?

Also, I’m not really sure how to do the actual conversion/copy of the raw pixel data, i.e. how to fill the buffered Image. Help would be appreciated!

Thank you all in advance!

With best regards,
Oliver


Edit:
The question is easy:
How to convert a Texture/TextureData into a (Buffered)Image???