What offscreen document reason should I use for this?

20 views
Skip to first unread message

get.yo...@gmail.com

unread,
11:36 AM (4 hours ago) 11:36 AM
to Chromium Extensions
I need to do this in an offscreen document:

let img = new Image("...data url...")

What reason should I specify?

Oliver Dunk

unread,
11:39 AM (4 hours ago) 11:39 AM
to get.yo...@gmail.com, Chromium Extensions
Hi,

Could you elaborate on the use case for doing this?

I also saw your messages about not being able to post here - sorry about that. We have a moderation queue for new authors and it can take a little longer for one of us to see it over the weekend. Any future messages you post should go through.

Thanks,
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/557f7d9b-4f31-44ee-8eeb-6f0eea21fad6n%40chromium.org.

Getfree

unread,
12:37 PM (3 hours ago) 12:37 PM
to Chromium Extensions, Oliver Dunk, Chromium Extensions, get.yo...@gmail.com
Thanks for fixing the auto-delete problem.
There's a mistake in the code. It should be like this:

let img = new Image(width, height)
img.src = ". . . DATA URL . . ."


I need to convert an image given as a data URL into the corresponding pixel data so I can paint it into an offscreen canvas. Then I will do additional manipulations on the canvas.

PhistucK

unread,
1:29 PM (2 hours ago) 1:29 PM
to Getfree, Chromium Extensions, Oliver Dunk
If you can convert the data URI to a Blob, you can create an ImageBitmap with it and draw it into the OffscreenCanvas, I think?
And then I suppose you have no need for an offscreen document.

PhistucK


Getfree

unread,
2:12 PM (1 hour ago) 2:12 PM
to Chromium Extensions, PhistucK, Chromium Extensions, Oliver Dunk, Getfree
Sadly ImageBitmap doesn't support all image formats that HTMLImageElement supports, such as SVG images, so I cannot use it.
Reply all
Reply to author
Forward
0 new messages