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

  • Home
  • SEARCH
  • 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 8640891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:23:18+00:00 2026-06-12T11:23:18+00:00

I got following problem: I load an image into my canvas and do stuff

  • 0

I got following problem:

I load an image into my canvas and do stuff with it (f.e. inverse the colors or more performance-needing stuff). After that I still want to be able to scale and rotate the canvas (or the manipulated image in it). That for (if I got it right) I need to redraw the image, well – the manipulation is gone then.

So:
– Can I save the image somehow and redraw it after the manipulation (ctx.save() and ctx.restore() seems not working in this case)
– Or do I have to rotate and scale by pixelmanipulation (wouldn’t be a problem, but would be cool if canvas-transformation could do it)

Thank you for your 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-12T11:23:19+00:00Added an answer on June 12, 2026 at 11:23 am

    You can achieve what you want using two canvas elements, drawing on one for your maniuplation and then drawing that canvas on the second to apply the rotation:

    var canvas1 = document.createElement('canvas'),
        canvas2 = document.createElement('canvas'),
        ctx1 = canvas1.getContext('2d'),
        ctx2 = canvas2.getContext('2d');
    
    /// use ctx1 to perform whatever manipulation you want, and then...
    
    /// start
    ctx2.save();
    /// shift our "hotspot" to the center
    ctx2.translate(canvas2.width / 2, canvas2.height / 2);
    /// rotate 45 degrees clockwise.. obviously you can do what you want here
    /// scale, fade, flip, stretch, rotate... whatever 
    ctx2.rotate(Math.PI / 4);
    /// draw your first canvas with it's manipulated image on to the second
    /// along with it's rotation
    ctx2.drawImage( canvas1, 0,0 );
    /// all done
    ctx2.restore();
    

    I find the above easier to work with, however you can also use the following, which will grab out / put back the current image data of a canvas element:

    ctx.getImageData();
    ctx.putImageData();
    

    You can find out how to use these here:

    https://developer.mozilla.org/en-US/docs/HTML/Canvas/Pixel_manipulation_with_canvas

    http://www.w3schools.com/html5/canvas_getimagedata.asp

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

Sidebar

Related Questions

I've got the following problem: after the user clicks on a thumbnail image, a
I'm having the following problem: When I got two labels into each other: <Label
I got following problem: I generate a div with jQuery-Load links. Theese links inside
I've got following problem: (c#) There is some class (IRC bot), which has method,
Ive got the following problem. I have a model called user which has a
I got the following problem: In my Android App I am using a table
I've got the following problem: I have two tables: (simplified) +--------+ +-----------+ | User
In Eclipse UI, I got the following problem, If you see left side, the
I have got a the following problem: I have got multi-step form where in
I've got the following theoretical problem. I'd like to be able to create multiple

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.