W3C home > Mailing lists > Public > public-html@w3.org > June 2008

Re: <canvas> JPEG quality

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 13 Jun 2008 08:59:41 +0000 (UTC)
To: Anne van Kesteren <annevk@opera.com>
Cc: HTML WG <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0806130857200.8559@hixie.dreamhostps.com>

On Thu, 5 Jun 2008, Anne van Kesteren wrote:
> 
> At Opera we're planning on adding support to <canvas> for JPEG as export 
> format. To make the file size reasonable there needs to be a way to set 
> the quality level of the JPEG. Wikipedia has a nice example of why that 
> matters:
> 
>   http://en.wikipedia.org/wiki/JPEG#Sample_photographs
> 
> One simple solution to this which is reasonably consistent with the rest 
> of the <canvas> API is to add a jpegQuality DOM attribute to the 
> <canvas> element which takes an integer in the range 0-1 (similar to 
> globalAlpha). The default value could maybe be 0.75 as that usually 
> gives reasonable looking images with a much smaller size than 1.0.
> 
> This attribute only affects toDataURL() and only when the first argument 
> is not omitted and case-insensitively matches "image/jpeg".

Added a way to pass the JPEG quality to toDateURL().

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 13 June 2008 09:00:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:18 GMT