Setting DPI-Value for Image Exports in Java

Hi all,

Recently, I tried to export a jpg and a bmp-file from a java-application and wanted to set the dpi-value to 300. Oh boy, that was not easy :-). That’s why I have the 2 links that finally helped me solve the problem collected here:

  • For jpg-files, please read the following (also read the chosen answer): http://stackoverflow.com/questions/233504/write-dpi-metadata-to-a-jpeg-image-in-java
  • For bmp-files, the following method was very helpful (look at the answer from inflamer): http://www.java-forum.org/awt-swing-javafx-and-swt/29574-bmp-imageio-schreiben.html

Funny, that since 2006, obviously there is still no easier option to write the DPI-value of a bitmap export (at least none that I found).