<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>10787</bug_id>
          
          <creation_ts>2010-09-28 04:21:56 +0000</creation_ts>
          <short_desc>Add a way to get a File/Blob from a &lt;canvas&gt;</short_desc>
          <delta_ts>2011-11-01 16:35:36 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#security-with-canvas-elements</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>39645</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2010-09-28 04:21:56 +0000</bug_when>
    <thetext>Section: http://www.whatwg.org/specs/web-apps/current-work/#security-with-canvas-elements

Comment:
I don&apos;t see a way to save the canvas data as a BMP or JPEG or anything else
that can then be uploaded via a FORM to a web server. This is a requirement, I
woudl think.

Posted from: 173.9.238.194</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39654</commentid>
    <comment_count>1</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2010-09-28 06:29:36 +0000</bug_when>
    <thetext>Check out the toDataURL() function.  It saves the canvas data as a PNG by default, though implementations may offer the ability to save it in other formats such as JPEG or BMP.

You can stuff this data in a form the obvious way, and decode it into an actual image file on the server easily.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39656</commentid>
    <comment_count>2</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2010-09-28 06:31:29 +0000</bug_when>
    <thetext>For what it&apos;s worth, firefox 4 recently added support for canvas.getAsFile() (though we added a vendor prefix so it&apos;s canvas.mozGetAsFile()) which has a similar syntax as canvas.toDataURL() but also takes an optional name.

Arguably canvas.getAsBlob() or canvas.toBlob() would be better since no name is needed.

Once a file/blob is retrieved it can be uploaded using XMLHttpRequest and optionally FormData.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>40080</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-09-30 08:10:21 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: none yet
Rationale: Adding a way to get a File or Blob from a &lt;canvas&gt; makes sense, but I&apos;d like to wait until the File API is a lot more stable and we have more experience with it before putting it in the spec.

Marking this LATER for now, but I&apos;ll revisit it occasionally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59413</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-11-01 16:35:36 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: canvas.toBlob()
Rationale: Concurred with reporter&apos;s comments.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>