Hello!!!
I am having a simple problem.
When I generate a large image with p5.graphics and then display it at a reduced size, it does not display nicely.
For example, the following code generates p5.graphics with a size 10 times larger than the canvas size, draws a circle, and then reduces the size to 1/10 on the canvas. As a result, the edges of the circle are jagged. The original image is anti-aliased, but when the image is scaled down, it inevitably becomes jagged.
function setup() {
createCanvas(400, 400);
let offscr = createGraphics(4000,4000);
offscr.background(200);
offscr.noFill();
offscr.stroke(0);
offscr.strokeWeight(100);
offscr.circle(2000,2000,3000);
image(offscr,0,0,400,400,0,0,4000,4000);
}
If I save an output image 10 times larger than the original and display it smaller in windows photo, it is beautifully anti-aliased.
I think there is a difference in the reduction algorithm between the two.
Is there any way to shrink the image cleanly with the standard p5.js functionality?
Or do I have to insert a known shrinking algorithm myself?
Thank you for your reply!
I also tried SMOOTH but the situation remained the same. Apparently the p5js reduction algorithm is a perfect thinning. I would like to try to calculate the weighted average with pixel array.