# Processing Export not registering Hi-DPI

**URL:** <https://discourse.processing.org/t/processing-export-not-registering-hi-dpi/28739>\
**Category:** Processing\
**Created:** [March 22, 2021, 6:37pm UTC](https://discourse.processing.org/t/processing-export-not-registering-hi-dpi/28739 "2021-03-22T18:37:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ink](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ink/32/12500_2.png) [@ink](https://discourse.processing.org/u/ink)\
**Post date:** [March 22, 2021, 6:37pm UTC](https://discourse.processing.org/t/processing-export-not-registering-hi-dpi/28739/1 "2021-03-22T18:37:33Z")

</div>

Hey there Community!

Currently having an issue with exporting a Processing-Application I developed.  
So, (I know, bad practices), I hardcoded all the pixel values and now I added the pixelDensity(displayDensity()); line to work with my Hi-DPI display (else it’s tooo small).  
When running it using the bin processing-java, it works. When running it from the application itself, it works. But if I export the application and run it through the executable it doesn’t. Neither have I found a solution, nor anything about it on the internet, so I thought maybe somebody here knows what’s going on. 🙂 😉

---

<div class="post-metadata">

**Author:** ![ink](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ink/32/12500_2.png) [@ink](https://discourse.processing.org/u/ink)\
**Post date:** [March 22, 2021, 6:39pm UTC](https://discourse.processing.org/t/processing-export-not-registering-hi-dpi/28739/2 "2021-03-22T18:39:33Z")

</div>

Oh and I’m using the latest stable Processing-version, Java 1.8.0\_282 on latest Arch Linux

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [March 22, 2021, 7:12pm UTC](https://discourse.processing.org/t/processing-export-not-registering-hi-dpi/28739/3 "2021-03-22T19:12:53Z")

</div>

Hi,

Welcome to the community! 😉

Could you try to print the display density let’s say in the `setup()` function :

```auto
void setup() {
  println("displayDensity : " + displayDensity());
}

```

And re export your application then tell us what’s the output in the console?

Also compare that value when running the sketch with the Processing IDE and the `processing-java` executable.

---

<div class="post-metadata">

**Author:** ![ink](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ink/32/12500_2.png) [@ink](https://discourse.processing.org/u/ink)\
**Post date:** [March 22, 2021, 7:44pm UTC](https://discourse.processing.org/t/processing-export-not-registering-hi-dpi/28739/4 "2021-03-22T19:44:16Z")

</div>

Thanks for the reply, I checked and when running it through Processing or the executable it properly shows 2, when running it through the exported application is falsely shows 1.

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [March 22, 2021, 9:52pm UTC](https://discourse.processing.org/t/processing-export-not-registering-hi-dpi/28739/5 "2021-03-22T21:52:35Z")

</div>

All right, thanks for the reply.

Time to look at the [source code](https://github.com/processing/processing)! 😀

```auto
// processing/core/src/processing/core/PApplet.java

public int displayDensity() {
    if (display != SPAN && (fullScreen || present)) {
      return displayDensity(display);
    }
    // walk through all displays, use 2 if any display is 2
    for (int i = 0; i < displayDevices.length; i++) {
      if (displayDensity(i+1) == 2) {
        return 2;
      }
    }
    // If nobody's density is 2 then everyone is 1
    return 1;
  }

 /**
  * @param display the display number to check
  */
  public int displayDensity(int display) {
    if (PApplet.platform == PConstants.MACOSX) {
     // !! Not interesting in this case, removed it ;) !!
    } else if (PApplet.platform == PConstants.WINDOWS ||
        PApplet.platform == PConstants.LINUX) {
      if (suggestedDensity == -1) {
        // TODO: detect and return DPI scaling using JNA; Windows has
        // a system-wide value, not sure how it works on Linux
        return 1;
      } else if (suggestedDensity == 1 || suggestedDensity == 2) {
        return suggestedDensity;
      }
    }
    return 1;
  }

```

And also if you wonder where does the `suggestedDensity` variable comes from (inside the `runSketch` method) :

```java
// Set the suggested density that is coming from command line
// (most likely set from the PDE based on a system DPI scaling)
sketch.suggestedDensity = density;

```

So if we suppose that one of `fullscreen` or `present` variables is true then it’s calling the `displayDensity()` method with the index of the display (it’s the same if not, it’s checking every screens).

In that function it checks if running on OSX or Linux / Windows. In our case it’s Linux so we check again if the display density is equal to -1 **which is true** if you didn’t pass the `--density` argument to the executable so it returns 1!!

However as stated in the code it’s a TODO… 😋
