[whatwg] Canvas toDataURL and device dpi resolution

Edward O'Connor eoconnor at apple.com
Thu Dec 1 11:44:52 PST 2011


John Knottenbelt wrote:

> How should the data url returned by toDataURL be sized in the case of
> a high device dpi resolution system? E.g. where the canvas's backing
> store horizontal and vertical dimensions are some multiple of the
> specified width and height in CSS pixels.

In the case of getImageData(), the spec says:

"[T]he data returned by getImageData() is at the resolution of the
canvas backing store. This is likely to not be one device pixel to each
CSS pixel if the display used is a high resolution display."

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#pixel-manipulation

I would expect toDataURL() to use the same underlying machinery as
getImageData() behind the scenes. This should definitely be clarified in
the spec.

> Is this correct behaviour, or is the test correct and I simply have a
> bug in WebKit?

I believe WebKit behaves correctly in this case.


Ted



More information about the whatwg mailing list