Hi All
I have been using
image = ImageIO.read(new File(“assets/Textures/alphamap.jpg”));
to load a bufferedImage
i use the image get the rgb value of a co-ordinate, to place vegetation on my terrain.
int pixel = image.getRGB(x, y);
int alpha = (pixel >> 24) & 0xff;
int red = (pixel >> 16) & 0xff;
int green = (pixel >> 8) & 0xff;
int blue = (pixel) & 0xff;
This works great when I’m running the game through JME SDK but when i package the game into a jar and try to run it, it cant find the image
javax.imageio.IIOException: Can’t read input file!
at javax.imageio.ImageIO.read(ImageIO.java:1301)
at com.jme3.lostVictories.SimpleGrassControl.setSpatial(SimpleGrassControl.java:154)
I can see the image included in assets.jar and
assetManager.loadModel(“Models/Vehicles/armored_car2.j3o”); and
imageBuilder.filename(
both seem to work.
Is there some way i can get ImageIO.read to find the right file path from the jar? or is there a easier way for me to load the image and the RGB of a pixel?