ImageToAwt conversion flips image

Try following code. It loads texture, takes it’s image, converts it to BufferedImage and saves to file. Problem is that new file is fliped along horizontal axis, which is imo wrong.



[patch]package tests;



import java.awt.image.BufferedImage;

import java.io.File;

import java.io.IOException;



import javax.imageio.ImageIO;



import jme3tools.converters.ImageToAwt;



import com.jme3.app.SimpleApplication;

import com.jme3.asset.plugins.FileLocator;

import com.jme3.texture.Texture;



public class ImageFlip extends SimpleApplication {





public static void main(String[] args) {

ImageFlip i = new ImageFlip();

i.start();

}



@Override

public void simpleInitApp() {

assetManager.registerLocator(“assets”, FileLocator.class.getName());

Texture texture = assetManager.loadTexture(“test.png”);

BufferedImage image = ImageToAwt.convert(texture.getImage(), true, true, 0);

File output = new File(“test_fliped.png”);

try {

ImageIO.write(image, “png”, output);

} catch (IOException e) {

e.printStackTrace();

}

}



}[/patch]

Its not ImageToAwt thats flipping it. Its assetManager.loadTexture(). To fix it, create your own TextureKey and then set the flipY parameter on it to false and then use it to load the texture