Saving image from CreateGraphics doubles resolution

Hello!

I am working on a bit of code, and have recently put in the createGraphics() function. When saving the image created by createGraphics, my resolution is doubled.

print(graphics.width); //gives me 800 - the correct width.
print(graphics.height); //gives me 600 - the correct height.

after saving the image my dimensions are 1600x1200. This was not the case when I was defining the image from the canvas 0,0 point (not using createGraphics).

My goal with using createGraphics is that I could manipulate where the image is on the screen and save it at its correct resolution wherever it may be located.

Thanks all!

edit
quickly made another sketch with nothing else in it to demonstrate the issue.
https://editor.p5js.org/TedCharlesBrown/sketches/Sc-Qk9qll*

1 Like

if you use

pixelDensity(1);

it works here,
play with
https://editor.p5js.org/kll/sketches/I_NCyfDYR
and shows here:

 org pdensity 2 
 org ddensity 1.25 
 set density 1 
 graphics.width 100 

even the pixel and display density not fully clear.

also i not try to set it for the graphics object only?possible?

2 Likes