Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8823869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:27:57+00:00 2026-06-14T06:27:57+00:00

I need to save my canvas data with id=’area’ as an image to my

  • 0

I need to save my canvas data with id=’area’ as an image to my server in folder /uploads with javascript.

I tried to display image in browser with window.open(canvas.toDataURL(“image/png”)); but browser displays blank screen

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:27:58+00:00Added an answer on June 14, 2026 at 6:27 am

    you can use the toDataURL()

    Note : The toDataURL() method requires that any images drawn onto the canvas are hosted on a web server with the same domain as the code executing it. If this condition is not met, a SECURITY_ERR exception is thrown.

    for example

     <body>
        <canvas id="myCanvas" width="578" height="200" style="display:none;"></canvas>
        <img id="canvasImg" style="border:1px solid #9C9898;" alt="Right click to save me!">
        <script>
          var canvas = document.getElementById('myCanvas');
          var context = canvas.getContext('2d');
    
          // draw cloud
          context.beginPath();
          context.moveTo(170, 80);
          context.bezierCurveTo(130, 100, 130, 150, 230, 150);
          context.bezierCurveTo(250, 180, 320, 180, 340, 150);
          context.bezierCurveTo(420, 150, 420, 120, 390, 100);
          context.bezierCurveTo(430, 40, 370, 30, 340, 50);
          context.bezierCurveTo(320, 5, 250, 20, 250, 50);
          context.bezierCurveTo(200, 5, 150, 20, 170, 80);
          context.closePath();
          context.lineWidth = 5;
          context.fillStyle = '#8ED6FF';
          context.fill();
          context.strokeStyle = '#0000ff';
          context.stroke();
    
          // save canvas image as data url (png format by default)
          var dataURL = canvas.toDataURL();
    
          // set canvasImg image src to dataURL
          // so it can be saved as an image
          document.getElementById('canvasImg').src = dataURL;
    
        </script>
      </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I need to save image data drawn on a <canvas> element. And there
I need some help here.. Im trying to save a canvas image after drawing..
(sorry for my english) I need save an image in the application path and
I need to save some classes and data structures to a file. My first
I need to save images in certain folder of my application: string path=E:\AJAXEnabledWebSite1\images\gallery I
I need to save an camera image from my application to the desktop so
I need to save WPF FlowDocuments to SQL Server. What is the best format
I am working on an application in which i need to save table data
I need to be able to save an image (format doesn't matter) of the
I am trying to display an image with canvas that allows zoom and panning

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.