here’s a piece of code that doesn’t give the same result in versions 4.4.1 and 4.4.6.
The result is normal in 4.4.1, and the entire image is copied into the “Preview” variable.
With version 4.4.6, only the top-left corner is copied.
(Mac Intel version)
fred
PImage img;
PGraphics Graphics;
PImage Preview;
void setup() {
size(1000, 1000, P2D);
img = loadImage("sunset.jpg"); // Load the image into the program
Graphics = createGraphics(width, height, P2D);
}
void draw() {
Graphics.beginDraw();
Graphics.image(img, 0, 0, Graphics.width, Graphics.height);
Graphics.endDraw();
Preview = createImage(200, 200, RGB);
/// This next line will copy the all Graphics into preview with version 4.4.1
// and only a part of it with version 4.4.6
Preview.copy(Graphics, 0, 0, width, height, 0, 0, Preview.width,Preview.height);
image(Preview, 0, 0, width, height);
}
Hi @fredciel. Glad you found the solution! Just one thing I would clarify about your conclusion. The default pixelDensity is not determined by version number, but is dynamically determined depending on display density.
Since Processing 4.4.3, the default pixelDensity() is no longer fixed at 1. Instead, it automatically matches your display’s resolution. On a Retina screen that often means 2, but the exact value depends on the display.
This change was made so sketches appear sharper on high-resolution screens without requiring extra setup. The trade-off is that some image functions, like copy(), may behave differently, as you noticed.
The issue is being tracked in issue #693 and a there is a fix in progress in PR #1145.