Nifty GUI - Image Quality

Hi,

this might be an easy to solve problem, at least I hope so: I built a slide-show with nifty GUI dynamically loading NiftyImages. I use the following code:
[java]
NiftyImage nextImage = nifty.getRenderEngine().createImage(nifty.getCurrentScreen(),slidesFolder+"/"+nextImagename, false);
Element niftyElement = nifty.getCurrentScreen().findElementByName(“slide_image”);
// swap old with new image
niftyElement.getRenderer(ImageRenderer.class).setImage(nextImage);
[/java]

My Problem is that the quality of the images is rather low, although they are loaded in original size and they look far better when opening them in some image editor. Here is an example of the two images compared (left is original, right is within the Nifty GUI):

Any Ideas how to improve the image quality?

That did the tricks for me:
Nifty manual page.36

„filter“ as boolean, Default: false
Use linear filtering of the image when set to „true“ or nearest when set to „false, which is the
default.

There must be a way to activate it in java too…

1 Like

Great! Its even right in my Code :slight_smile: just set the filter to true when creating the Image :slight_smile:

[java]
NiftyImage nextImage = nifty.getRenderEngine().createImage(nifty.getCurrentScreen(),slidesFolder+”/”+nextImagename, true); //<-- set false to true
Element niftyElement = nifty.getCurrentScreen().findElementByName(“slide_image”);
// swap old with new image
niftyElement.getRenderer(ImageRenderer.class).setImage(nextImage);[/java]

1 Like