How to store the image in the GuiNode?

Hi , I load a image , the size is 10241024 , now I scale half of it , and I want to store the image as 512512 , how can I do it , I don’t know how do get the image from the FrameBuffer , if you give me the answer , I would be appreciated



[java]

@Override

public void simpleInitApp() {

flyCam.setDragToRotate(true);

Quad quad = new Quad(1024, 1024);

Geometry cube = new Geometry(“My Textured quad”, quad);

Material mat_stl = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);

Texture tex_ml = assetManager.loadTexture(“D:\download\1024_1024.jpg”);

mat_stl.setTexture(“ColorMap”, tex_ml);

cube.setMaterial(mat_stl);

guiNode.attachChild(cube);

guiNode.setLocalTranslation(0, 0, 0);

// rootNode.attachChild(cube);

// rootNode.setLocalTranslation(0, 0, 0);

cube.scale(0.5f);



inputManager.addMapping(“store”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addListener(new ActionListener() {



@Override

public void onAction(String name, boolean isPressed, float tpf) {

if(name.equals(“store”)&&isPressed){

System.out.println(“store the image !”);

//TODO sotre the image as half of it ,as 512*512

}

}

}, new String[]{“store”});

}

[/java]

Open it in photoshop or gimp and scale it down…

oh , thank your answer , my purpose is store it by GPU , and I can also do it through read it into ImageBuffer and store it , but how to use GPU do it



thank you all the same !

I do not understand you very well because you seem to translate everything with google translate. Perhaps this is translated with google translate to answer yes, but I doubt it very much. I guess you want to get at the data bytes in a texture, it’s an easy way to use the following methods: Texture.getImage().getData(0)

hehe , my English is very poor , so I can not express my mean , now I believe English is very important once again !

yes , I want to get the data bytes in a texture , but I want to become a image from 1024x1024 to 512x512 , How can I do it use JME3 ?

First create an Image with that size and then set the bytes.

Actually I’m not sure what you want:

  1. Implement a GPU based scaling for images?
  2. Be able to reduce the size of your loaded textures at runtime?(CPu or GPU or does not matter?)