Search code examples
javaimagegraphics2ddpi

ditJava change dpi of graphics2D


I am using Graphics2D method for printing my images. I am doing this: g2D.drawImage(image, x, y, width, height); but the image drastically loose quality. I read that Java had default dpi set to 72. I want to have 144 dpi. How can i do it, when I am using Graphics2D method. I saw something similar on stack overflow, but it was on different drawing method. I am running Java 8. How can i do it? Thanks for help!

Edit: Just simply don't use java awt or swing, but use opengl with jogl or lwjgl


Solution

  • It's a long time since I posted this question. And since it isn't answered I will answer myself.

    Simple use opengl (jogl or lwjgl) which are much more customizable and lower level.