Skip to content

Fix p5.Image copy and blend destination scaling at pixel density above 1 - #9267

Closed
Ishaan-Gpt wants to merge 2 commits into
processing:mainfrom
Ishaan-Gpt:fix-image-copy-dest-density-9169
Closed

Ishaan-Gpt wants to merge 2 commits into
processing:mainfrom
Ishaan-Gpt:fix-image-copy-dest-density-9169

Conversation

@Ishaan-Gpt

Copy link
Copy Markdown

Resolves #9169

Changes:

  • In p5.Image.prototype._copyHelper (src/image/p5.Image.js), the destination coordinates passed to drawImage are now scaled by the destination image's pixel density, mirroring the source-side scaling that was already there. Before this, calling copy() or blend() on an image with pixelDensity(2) only covered the top-left quarter of the target area. The main-canvas path is untouched on purpose: the 2D renderer's context already applies a density transform there.
  • Added unit tests in test/unit/image/p5.Image.js covering copy and blend at pixel density 1 and 2, including a fractional destination region.

Screenshots of the change:
Not applicable, this is a pixel-level rendering fix covered by the new tests.

PR Checklist

Note on tooling: I used an AI coding assistant to help locate the relevant code and review the change. I checked the fix against the 2D renderer path to make sure it stays untouched, ran the new unit tests plus the full image test suite locally (all pass), and confirmed the new tests fail without the fix.

@ksen0

ksen0 commented Oct 27, 2026

Copy link
Copy Markdown
Member

Hello, thanks for your interest and for your clear disclosure of AI tool use! However, despite that, our contributor guidelines do require being assigned before making a PR. This can be reopened by another maintianer, but for now I'll close it. Thanks for understanding!

@ksen0 ksen0 closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: p5.Image.prototype.copy and blend do not scale destination coordinates for high pixel density

2 participants