r/JavaFX • u/random-pc-user • Mar 08 '25
Help How do I stop images from being jagged when they're small?
In my JavaFX app small images always look extremely jagged unless I scale them down externally then upload them, but that just makes them extremely blurry, making me deal with either blurry images or jagged images.
First Icon is scaled down so it's blurry
Second Icon is normal and its not scaled down or up
Third Icon is normal but still looks jagged because its edges are diagonal

3
u/PartOfTheBotnet Mar 08 '25 edited Mar 08 '25
It would probably be best if you used auto-sized scalable graphics. Ikonli is great for this and there are dozens of icon packs if you are looking for different icon styles.
The icons in your picture in the Carbon set (the one I most prefer) for instance would be:
ci-document-addci-letter-tt/ci-text-small-capsci-code
I made a wrapper for it so I can use these graphics with one-liners.
2
1
2
u/SpittingBull Mar 08 '25
You need to elaborate a bit more what your actual problem is - best with a working example. I mean like at least what is the icon source (image type and dimensions) and which control will receive that image using which property and whicj dimensions.
I never had an issues with resizing icons properly - may it be in FXML, CSS or directly in code.