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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:34:51+00:00 2026-06-03T21:34:51+00:00

I have two <canvas> elements in a document. I want to draw a shape

  • 0

I have two <canvas> elements in a document.

I want to draw a shape on canvas1, use the ctx1.getImageData() method to copy parts of that shape and animate these parts on canvas2.

I read that using ctx2.putImageData() is slower than using ctx2.drawImage().

How can i create an Image object from a CanvasPixelArray (which is returned from the ctx1.getImageData() call) in JavaScript?

(Note: I don’t want to copy the whole canvas1 but only parts of it. Also, I don’t care about old browsers)

  • 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-03T21:34:54+00:00Added an answer on June 3, 2026 at 9:34 pm

    This should do what you want, unless I’m missing something:

    ctx2.drawImage(canvas1, source_x, source_y, source_width, source_height, dest_x, dest_y, dest_width, dest_height);

    The drawImage() function works with both image and canvas elements, so there is no need to create a new image object or a temporary canvas unless you need to manipulate the pixels.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two images that i want to draw into a canvas object. I
I have two canvas's in a Grid, full scene images that I want to
I have two Canvas A and B, A is the child of B. A
I have an HTML5 Canvas on my page along with two text input fields.
I have two stored procedures I wish to use in my stored procedure, but
I have two columns: the left one is a Canvas containing an mx:Tree and
In jQuery, what happens when you have two .children() functions? var area = image.canvas.children('.image-pinpoint-edit').children('.image-pinpoint-edit-area');
I have an application with two Canvas controls. When the application starts, it loads
Ok, I have two controls in a Canvas that I can drag and drop.
I have two pages that use the flot jquery plugin, and they both work

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.