Re: [whatwg] Canvas element image scaling
On Sat, 18 Sep 2010, Rob Evans wrote: Has the canvas spec changed the way the drawImage function scales before drawing to canvas? On Sat, 18 Sep 2010, Tab Atkins Jr. wrote: It doesn't specify how the function scales at all: Note: This specification does not define the algorithm to use when scaling the image, if necessary.. Indeed. On Sun, 19 Sep 2010, Rob Evans wrote: Thanks for the reply. I'm already using high resolution images and I cannot cut sections of the image off because I am not using canvas to create thumbnails, I'm using it to create a game engine. I guess this is a question I will have to take up with the Firefox and Chrome developers directly, unless there are any devs here that know why I'm seeing a dramatic difference in scaling quality? This sounds like a quality-of-implementation issue. On Fri, 24 Sep 2010, Ruben Rodriguez II wrote: Forgive me as I have not kept up with all the discussions on this list, but have there been any suggestions with regards to NOT using a filter for rescaling? That would be ideal for 'old-skool' graphics where pixellation is actually desired, not smoothing. It's on the list of things to look at in future versions. In the meantime, browsers are experimenting in this area. -- Ian Hickson U+1047E)\._.,--,'``.fL http://ln.hixie.ch/ U+263A/, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Re: [whatwg] Canvas element image scaling
As others have pointed out, canvas scaling algorithm is not specified and is different in each browser. http://greggman.com/downloads/examples/canvas-test/test-01/canvas-test-01-results.html http://greggman.com/downloads/examples/canvas-test/test-01/canvas-test-01.html On Sat, Sep 18, 2010 at 7:51 PM, Rob Evans r...@mtn-i.com wrote: Thanks I'll give that a go in the morning! All the best, Rob On 19 Sep 2010 03:42, Boris Zbarsky bzbar...@mit.edu wrote: On 9/18/10 9:57 PM, Rob Evans wrote: Thanks for the reply. I’m already using high resolution ima... Gecko will scale canvas images in one of two ways: either using a nearest-neighbor algorithm or using a more complicated (bilinear, bicubic, may depend on other details) algorithm which is slower but usually gives better results. You can control which is happening by setting mozImageSmoothingEnabled on the canvas 2d context (set to false to get nearest-neighbor and set to true to get the other). The default value there is true. Does setting it to false give you the Chrome 6 behavior, perchance? I'd be a little surprised if it does, but worth trying. -Boris
Re: [whatwg] Canvas element image scaling
On 9/24/10 10:04 PM, Ruben Rodriguez II wrote: Forgive me as I have not kept up with all the discussions on this list, but have there been any suggestions with regards to NOT using a filter for rescaling? The mails you quoted mention how to do this in Gecko. -Boris
Re: [whatwg] Canvas element image scaling
On Sat, Sep 18, 2010 at 2:25 PM, Rob Evans r...@mtn-i.com wrote: Has the canvas spec changed the way the drawImage function scales before drawing to canvas? It doesn't specify how the function scales at all: Note: This specification does not define the algorithm to use when scaling the image, if necessary.. ~TJ
Re: [whatwg] Canvas element image scaling
It depends on the graphic lib of the browser. I think you can use a higher resolution picture which will not be shown, then you draw part of the higher resolution pic as the thumbnail. From: r...@mtn-i.com To: whatwg@lists.whatwg.org Date: Sat, 18 Sep 2010 22:25:12 +0100 Subject: [whatwg] Canvas element image scaling Has the canvas spec changed the way the drawImage function scales before drawing to canvas? I’ve been testing using Chrome 6 and now with Chromium 7 and Firefox 4 Beta 6 the image scaling looks significantly different to the way Chrome 6 scales with drawImage. Just interested to know if I can get the later browser test versions to render with drawImage the same way as the current release of Chrome, if the new scaling I’m seeing is expected behaviour or just because they are test versions. If it is expected behaviour, it seems like a step backwards for image quality! You can see the images for yourself here: http://irrelon.com/test/ Thanks! Rob Evans
Re: [whatwg] Canvas element image scaling
Hey ya, Thanks for the reply. I'm already using high resolution images and I cannot cut sections of the image off because I am not using canvas to create thumbnails, I'm using it to create a game engine. I guess this is a question I will have to take up with the Firefox and Chrome developers directly, unless there are any devs here that know why I'm seeing a dramatic difference in scaling quality? Again, you can see the images and their differing scaling quality here: http://www.irrelon.com/test/ Thanks! Rob From: Yp C [mailto:tccy...@hotmail.com] Sent: 19 September 2010 02:51 To: r...@mtn-i.com Cc: whatwg@lists.whatwg.org Subject: RE: [whatwg] Canvas element image scaling It depends on the graphic lib of the browser. I think you can use a higher resolution picture which will not be shown, then you draw part of the higher resolution pic as the thumbnail. _ From: r...@mtn-i.com To: whatwg@lists.whatwg.org Date: Sat, 18 Sep 2010 22:25:12 +0100 Subject: [whatwg] Canvas element image scaling Has the canvas spec changed the way the drawImage function scales before drawing to canvas? I've been testing using Chrome 6 and now with Chromium 7 and Firefox 4 Beta 6 the image scaling looks significantly different to the way Chrome 6 scales with drawImage. Just interested to know if I can get the later browser test versions to render with drawImage the same way as the current release of Chrome, if the new scaling I'm seeing is expected behaviour or just because they are test versions. If it is expected behaviour, it seems like a step backwards for image quality! You can see the images for yourself here: http://irrelon.com/test/ Thanks! Rob Evans
Re: [whatwg] Canvas element image scaling
On 9/18/10 9:57 PM, Rob Evans wrote: Thanks for the reply. I’m already using high resolution images and I cannot cut sections of the image off because I am not using canvas to create thumbnails, I’m using it to create a game engine. I guess this is a question I will have to take up with the Firefox and Chrome developers directly, unless there are any devs here that know why I’m seeing a dramatic difference in scaling quality? Gecko will scale canvas images in one of two ways: either using a nearest-neighbor algorithm or using a more complicated (bilinear, bicubic, may depend on other details) algorithm which is slower but usually gives better results. You can control which is happening by setting mozImageSmoothingEnabled on the canvas 2d context (set to false to get nearest-neighbor and set to true to get the other). The default value there is true. Does setting it to false give you the Chrome 6 behavior, perchance? I'd be a little surprised if it does, but worth trying. -Boris
Re: [whatwg] Canvas element image scaling
Thanks I'll give that a go in the morning! All the best, Rob On 19 Sep 2010 03:42, Boris Zbarsky bzbar...@mit.edu wrote: On 9/18/10 9:57 PM, Rob Evans wrote: Thanks for the reply. I’m already using high resolution ima... Gecko will scale canvas images in one of two ways: either using a nearest-neighbor algorithm or using a more complicated (bilinear, bicubic, may depend on other details) algorithm which is slower but usually gives better results. You can control which is happening by setting mozImageSmoothingEnabled on the canvas 2d context (set to false to get nearest-neighbor and set to true to get the other). The default value there is true. Does setting it to false give you the Chrome 6 behavior, perchance? I'd be a little surprised if it does, but worth trying. -Boris