How to rotate an Image

I have an Image object in a JComponent and I want to rotate it. How would I go about doing it in the paint() method?

The code creates a rotated image.
ImageIcon old=image;
        int max=Math.max(old.getIconHeight(), old.getIconWidth());
        BufferedImage buff=new BufferedImage(max, max, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d=(Graphics2D)buff.getGraphics();
        g2d.translate(-old.getIconWidth(),0);
        g2d.rotate(-Math.PI/2,old.getIconWidth(),0);
        g2d.drawImage(old.getImage(),0,0,null);
        image=new ImageIcon(buff);Regards,
Stas

Similar Messages

  • How to rotate an image/text box by degrees in Pages?

    I think pages can do this, but I just can't find out how to make it works.
    How do you rotate an image or text box by whatever degrees and orientation you like?
    Thanks!

    Welcome to Apple Discussions
    Here's a picture (link above).

  • How to Rotation 3D Image in LabWindows/CVI

    Hi All
    I have a 3D image and i want to rotate its x,y and z axis, how it is possible kindly help me.
    Regards
    Umer 

    Hello Umer
    When you say that you want to rotate the 3D graph, you mean programmatically? as you can rotate the 3D object using your mouse once the code is running. 
    To locate the examples in LabWindows/CVI that incorporate the 3D ActiveX Graph control, follow the steps below:
    Launch LabWindows/CVI.
    Browse to Help » Find Examples » Communicating with External Applications » ActiveX » General.
    3.  Select any of 3D projects which include
    3DGraph.prj, 3DGraphAxis.prj, 3DGraphColorMap.prj, and 3DGraphContours.prj.RegardsMart G

  • How do I rotate the image?

    I am using Adobe Photoshop CC and I need to know how to rotate an image.

    This is probably more than you ever wanted to know about rotating an image. It is an Information Sheet I wrote and distributed to my students and you may find it helpful.
    Three popular methods used to straighten a tilted scene, such as the one shown the first photograph above, are Image Rotation, Straighten and the Level feature in the Crop tool. Each requires you to draw a horizon line or similar reference as a first step in the process, and each produces slightly different result.
    Image Rotation*:
      1. Choose the Ruler tool. (It is nested with the Eyedropper tool.) Click and drag a reference line as shown in the middle image in the top row above.  (The area around the image was lightened and red circles were added for clarity.) Depending upon the subject, the line may be horizontal, as seen here, or vertical.
      2.  Choose Image > Image Rotation > Arbitrary. When the Rotate Canvas menu appears, click OK. The result will be similar to Fig.1 above, showing the entire image.
    Straighten*:
    Once again, begin by choosing the Ruler tool and drawing the reference line. A feature was added to the Ruler tool in version CS5 and it appears in the Options bar: the Straighten command. Click on it and the image will be rotated and cropped as seen at the top/right. If you prefer to have the image rotated but not cropped you may either:
      1. Hold down the Option key as you click on the Straighten command.
      or
      2. After clicking on the Straighten command, choose Edit > Undo Crop.
    In either case the result will be similar to Fig. 1 above.
    The Straighten command, which also appears in CS6, produces a similar image rotation and trims a small amount of picture area as seen in Fig. 2.
    The Crop Tool’s Level symbol:
    This latest innovation, introduced in CS6, uses a command found in the Options bar of the Crop tool. The equivalent of the Ruler tool is built into the carpenter’s level symbol to the left of the word Straighten in the Options bar. Click on the level and draw the reference line. The image will rotate and the largest rectangular dimensions will be framed by the Crop tool plus, in a shaded area, the part of the image that will be eliminated. This allows you to adjust the image area if desired before cropping the image. The result, before clicking on the Commit key on the right side of the Options bar, appears as seen in Fig. 3.
    * When Image Rotation or Straighten is used to tilt the image, each of which also shows blank areas created by the rotation, consider using the Content Aware Fill command,
    An oldie but goodie: Crop & Straighten
    The image below shows the result when File > Automate > Crop & Straighten Photos was applied to a three-image gang scan. Note that:
      1. Each print has clearly defined sides.
      2. Each print was separated from the others by at least a half-inch.
    This command creates a separate file for each cropped image and leaves the original file intact.

  • How do I rotate an image in Lightroom Mobile for the iPhone?

    Hi,
    Maybe I am missing something obvious, but I can't figure out how to rotate any images in Lightroom Mobile for the iPhone. The documentation is for the iPad and shows a rotate control on the right hand side of the screen, but no such control is showing up on the phone. I tried various numbers of fingers to just spin the image, but no luck. Can someone please let me know how this is supposed to work?
    Thanks!

    Hey, thanks!
    I had tried forever to figure that out. I could rotate up to about 45 degrees or so, but even that was hard to control.
    Thanks for the help.

  • Rotate an image in an applet

    Hi all,,,
    I was wondering how i rotate an image. As it stands now, i have the image reference in a variable and i need to know what the proper way is to reference that image with the Graphics2D class. I've tried a few things, but whenever i try to use the rotate method in Graphics2D, it gives me an error.
    Perhaps just a short snippet to give me a push in the right direction?
    Thanks
    Kyle

    This is my code:
    Graphics2D g2;
    int rotateD = 90;
    int w = paddleImage.getWidth(null) / 2;
    int h = paddleImage.getHeight(null) / 2;
    g2.rotate(Math.toRadians(rotateD),w,h);
    g2.drawImage(paddleImage);and this is my error:
    C:\java\projects\SuperPong>javac Paddle.java
    Paddle.java:61: cannot resolve symbol
    symbol  : method drawImage  (java.awt.Image)
    location: class java.awt.Graphics2D
                            g2.drawImage(paddleImage);
                              ^any idea what is wrong with the drawImage?
    thanks,
    Kyle

  • Rotate an image about it centre point

    Can some one please tell me how to rotate an image about its
    centre point in flex 2.0?
    I've tried using .rotation and looked at matrix
    transformation but I can't find a way to set the roatation to the
    centre of the image :(

    You can combine <mx:Move> with <mx:Rotate>
    effects together.
    http://livedocs.adobe.com/flex/201/html/behaviors_068_18.html
    ps
    I would LOVE to see example of applying matrix transformation
    to achieve the similar effect, cannot figure out yet by myself how
    to achieve it...

  • How to rotate a thumbnail image in Finder?

    Is there a way to rotate a thumbnail image in Finder? When I click a photo in a Finder folder, the image automatically opens in Preview and the image is correctly displayed right side up. But the thumbnail image is displaying a vertical photo horizontally. Can I rotate the thumbnail?

    corelle,
    please open the sidebar of the Preview window and check how the thumbnail is displayed there.
    If the orientation is wrong in the Preview sidebar as well, then apparently some program rotated the image but not the EXIF preview image, which is obviously not a good thing.
    If the orientation is correct in the Preview sidebar, but wrong in the Finder, then the file probably has a custom icon with wrong orientation. This should then be removed rather than rotated. It's useless anyhow because Snow Leopard's Finder can better use the EXIF preview image instead.

  • How do i rotate an image in keynote?

    Im trying to rotate an image in keynote bc im making a collage and i dont want all my images straight up and down. Does anyone know how to do that?

    Nevermind i figured it out =)

  • My video was recorded on my I phone 4, the camera was held sideways for a horizontal view, but loads in I movie vertically.  How can I rotate the image so it is horizontal?

    My video was recorded on my I phone 4, the camera was held sideways for a horizontal view, but loads in I movie vertically.  How can I rotate the image so it is horizontal?

    Drag the clip from your Event to your Project. Then use the Rotate, Crop, Ken Burns Tool on the Middle Toolbar to rotate it

  • How to rotate images in small increments in preview

    how to rotate images in small increments in preview?

    it is not going to happen in Preview. They took away that functionality quite a few OS ago.

  • How do you rotate an image in a Slideshow?

    DVDSP4 automatically rotates an image regardless. The problem is I don't want it rotated. How the heck do you rotate the image? There is no option in any of the menus or inspector windows I've found.

    Guess you have to rotate the image in photoshop..save as a jpg and then import as an asset again.
    try..(?)

  • How do I rotate an image itself?

    I understand how to use affine transforms to rotate an image as I'm drawing it but I need to rotate the image object itself. I cant find anything in the API. Is there anyway to do this?
    Thanks.

    I meant "How do I rotate an image in java?" I know I can load the image into gimp or whatever and create a new image. But that means my applet will have to download 4 times as many images to the client. I need to rotate an image object itself within java.

  • How can i rotate an image by a pivot point?

    Hello,
    i have a problem, the Imaq Rotate VI only rotate an image by its center. My problem is i need to do this by a known pivot point. How can i achieve this?
    Thank you,
    Francesco.
    Solved!
    Go to Solution.

    can this post help?
    http://forums.ni.com/t5/LabVIEW/Rotate-an-Image-by-specified-pixel/td-p/2570453
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • How to make an image map rotate?

    I have 4 images and how do i make them rotate with the image map part. Rotation removes the image mapping when it is done with Jquery. Help

    Sudarshan Thiagarajan wrote:
    The plug-in itself seems conky. http://blog.stableflow.com/jquery-plugins/360-degrees-product-view/ - doesn't do anything to the image on their plugin demo page.
    If you could tell us what you'd like to do with your anatomy images, maybe we can suggest a different solution?
    It rotates the image in my browser
    I want to make the body turn around 360 degrees when mouse is used to rotate,mean while the image map should be clickable on all 4 sides .

Maybe you are looking for

  • Outbound Delivery Document Flow (One-Step procedure) Goods Receipt

    I am trying to extract the Goods Receipt status of Outbound Deliveries which are posted using One-Step procedure.  I can do this one delivery at a time using VL03N. Some sites (plants) are configured with One-Step procedure and others are configured

  • Star Office files as attachments treated as "zipped"

    I just finally got around to upgrading my wife's iMac to Tiger - and it seems to have created a problem... She does some work for folks who use Star Office, and frequenty gets Star Office files as attachments. Under Panther, this was no problem - the

  • HELP How to download music from Musicstore to play on MP3 Player

    I just bought a okley sunglasses with MP3 Player... How can I buy music in a MP3 format on internet... Apparently the only way to buy/download music from internet on a mac it's with the music store but then it won't allow me to convert it into a MP3

  • Flow_dml.plb in the installation script is blowing with an error

    PL/SQL: ORA-01804: failure to initialize timezone information... I can't see the code because it's wrapped....

  • Simulating a table

    Hi folks, This is my first question as I am a newcomer to the AppleMac and in particular iWeb. Since there is no way of inserting an editable table in iWeb (why oh why!!?) I am trying to simulate one using small text boxes arranged in rows and column