# Image exports at wrong dimensions in 4.4.4

**URL:** <https://discourse.processing.org/t/image-exports-at-wrong-dimensions-in-4-4-4/46414>\
**Category:** Beginners\
**Created:** [May 20, 2025, 1:13pm UTC](https://discourse.processing.org/t/image-exports-at-wrong-dimensions-in-4-4-4/46414 "2025-05-20T13:13:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonofhop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sonofhop/32/17623_2.png) [@sonofhop](https://discourse.processing.org/u/sonofhop)\
**Post date:** [May 20, 2025, 1:13pm UTC](https://discourse.processing.org/t/image-exports-at-wrong-dimensions-in-4-4-4/46414/1 "2025-05-20T13:13:01Z")

</div>

Exporting images seems broken in Processing 4.4.4  
Here’s a sketch that demonstrates the issue. The canvas size is set to 500x500, but the .png file exports at 1000x1000. Exporting as .pdf or .svg results in the correct page size, but it only includes the upper left corner of the image.

```auto
/*Testing Export in Processing 4.4.4
* 
* canvas size is 500x500, but .png exports at 1000x1000
* PDF/SVG exports at 500x500, but only contains top, left corner of image
*/

//import libraries
import processing.svg.*; //for export
import processing.pdf.*; //for export

//change these settings
boolean record = false;

//declare global variables
float midX, midY; //store midpoints of screen

void setup() {
  size(500, 500);
  
  //derived variables
  midX = width/2;
  midY = height/2;
  
  noLoop();
  
}

void draw() {
  
  if (record) {
    beginRecord(PDF, "exportTest_##.pdf"); 
    //beginRecord(SVG, "exportTest_##.svg"); 
  }
  
  
  //drawing code goes here
  
  rectMode(CENTER);
  rect(midX, midY, width*0.9, height*0.9); //draw a box slightly smaller than the canvas
  
  //done drawing
  if (record) {
    endRecord();
    println("SVG/PDF recorded!");
    record=false;
    saveFrame("exportTest_##.png"); //save screenshot
    //println("PNG saved!");
  }

}

void keyReleased() {
 if (key == ' ') redraw(); //redraw the screen on spacebar
 if (key == 's') {
   record = true; 
   redraw(); //run again
 }
}

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 20, 2025, 1:36pm UTC](https://discourse.processing.org/t/image-exports-at-wrong-dimensions-in-4-4-4/46414/2 "2025-05-20T13:36:11Z")

</div>

> [@sonofhop](#):
>
> Here’s a sketch that demonstrates the issue. The canvas size is set to 500x500, but the .png file exports at 1000x1000.

Related topic:

> [@SVG Export Issue transform="scale(2,2)"](https://discourse.processing.org/t/svg-export-issue-transform-scale-2-2/46350/4):
>
> Here is the issue labelling why that this is broken [pixelDensity(2) with SVG creates incorrect viewport in the file · Issue #693 · processing/processing4 · GitHub](https://github.com/processing/processing4/issues/693) I’ve added some more labels to hopefully move this forward. Current workaround pixelDensity(1) in the setup() function to force Processing to render at low-dpi scaling.

`:)`

---

<div class="post-metadata">

**Author:** ![sonofhop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sonofhop/32/17623_2.png) [@sonofhop](https://discourse.processing.org/u/sonofhop)\
**Post date:** [May 20, 2025, 2:07pm UTC](https://discourse.processing.org/t/image-exports-at-wrong-dimensions-in-4-4-4/46414/3 "2025-05-20T14:07:56Z")

</div>

Thanks! pixelDensity(1) is what I needed.
