Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createImageBitmap from blob [v.2.0.0-rc10] #26032

Open
mcioffi opened this issue Oct 4, 2024 · 1 comment · May be fixed by #25517
Open

createImageBitmap from blob [v.2.0.0-rc10] #26032

mcioffi opened this issue Oct 4, 2024 · 1 comment · May be fixed by #25517
Labels
feat new feature (which has been agreed to/accepted) web related to Web APIs

Comments

@mcioffi
Copy link

mcioffi commented Oct 4, 2024

Version: Deno 2.0.0-rc10

The Web Canvas API in Deno for createImageBitmap supports blobs. Added earlier this year in #21898

Observations

Currently seeing failures against standard jpg/pngs. The same code in a non-Deno environment, e.g. browser, works. Omission of jpg seems intentional from the deno library , but is worth bringing up as its widely supported in web apis

async function loadImage(url) {
  try{
    const response = await fetch(url);
    const blob = await response.blob();
    const imageBitmap = await createImageBitmap(blob);
    return imageBitmap;
  }
  catch (error) {
    console.log(error)
  }
}
const jpg = await loadImage("https://deno.com/images/artwork/deno_city.jpeg")

InvalidStateError: Unsupported type 'image/jpeg'
    at ext:deno_canvas/01_image.js:236:15
    at eventLoopTick (ext:core/01_core.js:175:7)
const png = await loadImage("https://deno.com/images/artwork/deno_news.png")

TypeError: Color type 'Rgb8' not supported
    at ext:deno_canvas/01_image.js:241:50
    at eventLoopTick (ext:core/01_core.js:175:7)

Environment

Screenshot 2024-10-04 at 3 35 58 PM

@crowlKats crowlKats added the web related to Web APIs label Oct 4, 2024
@littledivy littledivy added the feat new feature (which has been agreed to/accepted) label Oct 5, 2024
@petamoriken
Copy link
Contributor

related #25517

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat new feature (which has been agreed to/accepted) web related to Web APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants