Open Bug 783942 Opened 8 years ago Updated 2 years ago

[Great Idea] Using ImageData as image or URL.createObjectURL(ctx.createImageData(width,height))

Categories

(Core :: DOM: Core & HTML, enhancement, P5)

enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: alexei03a, Unassigned)

Details

(Keywords: APIchange, html5, Whiteboard: [needs spec])

Attachments

(1 file, 5 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120713134347

Steps to reproduce:

I suggest that, by analogy with the Blob, make it possible to use as an image. Unlike toDataURL, not to encode in PNG and other formats (shorter static) to display. As the image is used in JavaScript object reference "ImageData", which can be easily decoded (to say the least, in fact - a simple drawing of a decoded ImageData) browser.


Actual results:

Did not want to encode Blob URL, but it should.


Expected results:

It is necessary to make it possible to use the crude imageData of image quality.
Just please do not close on the empty subject, and all the good think, my opinion is this:
- Security (due to the already existing techniques)
- Fixed size ImageData (otherwise have to make a new ImageData, and accordingly its link)
- High perfomance (because you just pass system crude ImageData, and he can only draw)
- No coding in PNG and other formats (and therefore less damaging to performance)
- Use non-encoded Base64 URL, a link to the ImageData object.
- Ability to save it in any format (context menu).

My idea opens up new possibilities in image editing (including the use of the filter), and in decoding unfamiliar formats. ImageData is relatively safe. Do not dismiss this idea!
For make:

var canvas = document.createElement("canvas");
var imagedata = ctx.createImageData(0,0,100,100);
animateOrManipulate(imagedata);
var url = URL.createObjectURL(imagedata);

...Usage:

var image = document.getElementById("image");
image.src = url;
Severity: normal → enhancement
Priority: -- → P1
Component: Untriaged → General
Keywords: needURLs
Attached file ImageData URL testcase (obsolete) —
Summary: [Great Idea] URL.createObjectURL(CanvasContext.createImageData(0,0,100,100)) → [Great Idea] URL.createObjectURL(CanvasContext.createImageData(w,h))
Summary: [Great Idea] URL.createObjectURL(CanvasContext.createImageData(w,h)) → [Great Idea] Using ImageData as image url or URL.createObjectURL(ctx.createImageData(width,height))
Summary: [Great Idea] Using ImageData as image url or URL.createObjectURL(ctx.createImageData(width,height)) → [Great Idea] Using ImageData as image or URL.createObjectURL(ctx.createImageData(width,height))
OS: Windows 7 → All
Hardware: x86_64 → All
Version: unspecified → Trunk
I'll list a few more useful features:
- Multithreading animation by WebWorker.
Attachment #653255 - Attachment is obsolete: true
http://jsperf.com/canvas-todataurl-imagetype-performance/9
There is even evidence that getImageData faster.
Component: General → DOM
Priority: P1 → --
Product: Firefox → Core
So what is the proposal here?  To make createObjectURL take ImageData in addition to Blobs and Files?
Whiteboard: [needs spec]
Yes, this is my proposal...
At the moment I do not have the specification, but I can articulate that the image is taken from the link ImageData. The technology was invented by me is similar to WebRTC.

If I write a specification, it will be too short, in addition to HTML5 Canvas.
I'll give you an explanation of why add ImageData to Blob and File. ImageData data stores, as well as PNG or any other format, the truth in mind, but all the same. And ImageData, in contrast to all, can be dynamic. ImageData this image always RGBA32.
ImageData - format, free from any defects.
Attached file fixed testcase (obsolete) —
Attachment #653317 - Attachment is obsolete: true
Attached file Fixed ImageData size (obsolete) —
Attachment #653739 - Attachment is obsolete: true
Attached file Fix again (obsolete) —
Attachment #657534 - Attachment is obsolete: true
Attached file Added border
Attachment #657535 - Attachment is obsolete: true
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.