UnsupportedOperationException: Image format: BGR8

Hey,

i updated my JME, fixed my heightmap code and now get this error:



[java]java.lang.UnsupportedOperationException: Image format: BGR8

at com.jme3.terrain.heightmap.ImageBasedHeightMap.getHeightAtPostion(ImageBasedHeightMap.java:170)

[/java]

at[java]heightmap.load();[/java]



I think its the texture or the way its crated, because other textures from Photoshop are working fine,

BUT my texture is created throug java with BufferedImage ( with “BufferedImage.TYPE_INT_RGB” ) <<RGB and not BGR!!!

and ImageIO.write.



Can you help me?

I had the same problem. For heightmap images, make sure that the image is saved as grayscale.

@batkid said:
I had the same problem. For heightmap images, make sure that the image is saved as grayscale.

I don't think you mean BufferedImage.TYPE_BYTE_GRAY, are you?
Can you give me some code?

That’s what I mean, but my code only edits the BufferedImage, not create them. Here is the relevant code:



[java]

image = ImageIO.read(new File(baseDir + imageFile));

.

.

.

if (image.getType() == BufferedImage.TYPE_BYTE_GRAY) {

// perform editing of image

}

[/java]

1 Like

Ok, start testing…

[java]heightMapImage.getImage().setFormat(Format.RGB8);[/java]



//CLOSE