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 8823833
In Process

The Archive Base Latest Questions

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

I have a canvas where the user make interactions, then a <img> for the

  • 0

I have a canvas where the user make interactions, then a <img> for the final “product”. The <img> tag has the style properly filled with the data URI of the first canvas.

I now need to fetch this “canvas” as a element then transform it into a canvas object. Example:

var canvas = parent.document.getElementById('canvas_holder');
var context = canvas.getContext("2d");
context.strokeStyle = '#f00';
//etc... 

*canvas_holder* is the <img> tag with style set to real canvas data URI. How would I go to make this thinking work? I can not change the structure of the <img>, unfortunately.

Appreciate any help!

  • 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:26+00:00Added an answer on June 14, 2026 at 6:27 am

    I think the OP wants to tell us that the image is a combination of a foreground image transparent.png and a background image which is represented by its base64 encoded version. The only way I see is to grab the background image from

    var image = new Image();
    image.src = $('#canvas_holder').css('background-image').match(/url\("?'?(.*)"?'?\)/)[1];
    //  If you don't want to use jQuery, you could get the background-image as
    // image.src = document.getElementById('canvas_holder').style.backgroundImage.match(/url\("?'?(.*)"?'?\)/)[1];
    

    and paste it onto the canvas.

    var canvas = document.getElementById('yourcanvasid');
    var ctx = canvas.getContext('2d');
    ctx.drawImage(image, 0, 0);
    

    and then get the foreground image and paste it onto the same canvas

    var foreGround = document.getElementById('canvas_holder');
    ctx.drawImage(foreGround, 0, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a canvas which user can interact to make changes to design. Now
I have a canvas page with a form. When the user submits the form,
I have this canvas mousedown event: $('#canvas').mousedown(function(e) { var coords = canvas.getMousePos(e); // user
I have a User Control added to a Canvas. In another area of the
I have a Canvas which has many components inside it and those again, have
I have a simple application that allows the user to draw in the canvas
I have a basic paint application on a canvas, and I want to make
I'm building an application that allows the user to POST HTML5 canvas data that
I have a Window with my user control and I would like to make
I have to make an iPhone app for a company which has a web

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.