Skip to content

Fix loadImage SVG file loading regression#8937

Open
gfrancine wants to merge 4 commits into
processing:mainfrom
gfrancine:main
Open

Fix loadImage SVG file loading regression#8937
gfrancine wants to merge 4 commits into
processing:mainfrom
gfrancine:main

Conversation

@gfrancine

@gfrancine gfrancine commented Jun 18, 2026

Copy link
Copy Markdown

Resolves #8921

Changes:

  • Load images with HTMLImageElement instead of createImageBitmap.

    Reverts to the loadImage implementation in p5.js <v2.0 (pre- commit e43f709, which introduced the regression).

createImageBitmap cannot load vector images and will reject with an InvalidStateError.

Further reading:

PR Checklist

@gfrancine gfrancine force-pushed the main branch 3 times, most recently from e64954a to 660f9ab Compare June 18, 2026 13:09
@gfrancine gfrancine changed the title fix: handle SVGs in loadImage fix: handle vector images (SVGs) in loadImage Jun 18, 2026
@gfrancine gfrancine marked this pull request as ready for review June 18, 2026 13:42
@gfrancine gfrancine changed the title fix: handle vector images (SVGs) in loadImage fix: loadImage SVG file loading regression Jun 18, 2026
@gfrancine gfrancine changed the title fix: loadImage SVG file loading regression Fix loadImage SVG file loading regression Jun 18, 2026
@p5-bot

p5-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: b26caed

Previous deployments

This is an automated message.

@gfrancine gfrancine marked this pull request as draft June 19, 2026 04:37
…map`

`createImageBitmap` throws when loading vector images -- revert to initial `loadImage` implementation pre- commit e43f709

See https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap
The pre-v2.0 implementation, which loadImage was reverted to, requests the same image twice. Use the fetched blob data instead
@gfrancine gfrancine marked this pull request as ready for review June 19, 2026 05:06
@gfrancine

gfrancine commented Jun 19, 2026

Copy link
Copy Markdown
Author

Tiny important edit: the old implementation that loadImage was reverted to works by setting the Image src to the source path, which means the same image is loaded twice. Use the already-fetched image data instead (53b2068)

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.

[p5.js 2.0+ Bug Report]: loadImage cannot load SVG files

1 participant