How could you go about rotating an image?

edited December 2014 in Using Processing

I need to be able to rotate an image around a point so that if the image were rotated it would be upside down. The rotate() function will obviously only translate the display point letting be the orientation of the image itself. Any help is appreciated thankyou. I will accept working normal java code solutions.


  • Do you mean you want to scale an image and when the scale becomes negative the image is inverted?

  • Answer ✓

    I am going to assume that this function is going to be called from the draw method.

    To separate this transformation from others (perhaps you have 2 images to rotate) the code should be surrounded by calls to pushMatrix and popMatrix. I assume that you want to rotate about the image center so you will need to use imageMode(CENTER) putting that together you get


    Wrap this into a function passing x, y and angle as parameters and Bob's your uncle. You also might want to investigate pushStyle() and popStyle() to isolate changes made from things like fill(), rectMode() etc.

  • quark can I publish it that on our groups wiki?

  • edited December 2014

    @Chrisir any code, comments, explanation etc. that I put in the public domain such as this forum and my website can be used, modified, published or otherwise distributed in anyway you or anyone else wishes. With the following conditions

    1) If I am being quoted e.g. quark says "blah, blah, blah", then it should be reproduced verbatim and with a link to the original source.

    2) Any information provided by me through private communications should not be reproduced or otherwise made available in the public domain.

    3) It would be nice to be identified as the author of the work, or 'based on work by' for modified code and a link to the source and / or my website but it is not essential.

    Obviously I can't enforce any of the above, so thanks for asking. :)

  • thanks! I'll keep you up to date.

Sign In or Register to comment.