Rotating image affects location

Following up on the animated half image and placing labels on the curve I finally got the layout right. Though the curious thing is, when rotating the wheel, the control y position changes.
First I thought that this might be a similar effect, that could be solved with setting the inset, but that is not true.
My theory is that, as the image is square, when the square rotated by 45 degrees the height is larger. How can I counteract this. I tried to update the translateY property but that had no effect.

What I have figured out so far is the following: As the image is basically a rectangle, when rotating the square by 45° it's height is larger than unrotated. This application demonstrates it:
package javafxtest;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Bounds;
import javafx.geometry.Point2D;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class RotatedClippedArea extends Application {
    @Override
    public void start(Stage stage) {
        stage.setTitle("Steering Wheel");
        Group root = new Group();
        Scene scene = new Scene(root, 1000, 350);
        scene.setFill(Color.LIGHTBLUE);
        HBox hBox = new HBox();
        hBox.setSpacing(10);
        //Group g = new Group(background);
        for (int i = 0; i<=90; i += 20) {
            VBox vbox = new VBox();
            SteeringWheelGroup background = new SteeringWheelGroup(200, i);
            Label angle = new Label("Angle: "+i+"°");
            final Label heigth = new Label("Heigth: "+background.getBoundsInLocal().getHeight()+"px");
            heigth.boundsInLocalProperty().addListener(new ChangeListener<Bounds>(){
                @Override
                public void changed(ObservableValue<? extends Bounds> ov, Bounds t, Bounds t1) {
                    heigth.setText("Heigth: "+t1.getHeight()+"px");
            vbox.getChildren().addAll(background, angle, heigth);
            hBox.getChildren().add(vbox);
        root.getChildren().addAll(hBox);
        stage.setScene(scene);
        stage.show();
    private Point2D calculateBasePoint(Point2D center, double radius,
            double angle) {
        float newX = (float) (center.getX() + radius * Math.cos(Math.toRadians(angle)));
        float newY = (float) (center.getY() + radius * Math.sin(Math.toRadians(angle)));
        return new Point2D(newX, newY);
    private class SteeringWheelGroup extends Group {
        private double scale;
        public SteeringWheelGroup(int destinationWidth, double angle) {
            //InputStream is = getClass().getResourceAsStream("SteeringWheel.png");
            //Image unscaled = new Image(is);
            Rectangle rect = new Rectangle(getImageWidth(), getImageWidth(), Color.RED);
            scale = destinationWidth / rect.getWidth();
            //ImageView steeringWheel = new ImageView(unscaled);
            rect.setScaleX(scale);
            rect.setScaleY(scale);
            rect.setRotate(angle);
            Group rotationGroup = new Group(rect);
            int width = getImageWidth();
            Rectangle clip = new Rectangle(0, 0, width, width / 2);
            rotationGroup.setClip(clip);
            this.getChildren().add(rotationGroup);
        public double getScale() {
            return scale;
        public final int getImageWidth() {
            return 479;
    public static void main(String[] args) {
        Application.launch(args);
This will create this application.
What seems inconsistent that the clipping initialized with half the height in the unrotated state, will always clip half the height. I would have expected to only get the the top 200 pixels of the image irrelevant of the current state of the rendering.
But the basic question is: How can I figure out the current height? The boundsInLayout will always return the same value. I could calculate the height of the visible part using the angle of the rotation but would like to avoid that.
If I get the current height I can apply a second clip which basically translated the the whole thing. While this may not make sense for this example, my use case involves an image with a centered circle, so the most top visible part of the image will always be at the same height above the (clipped) bottom line.

Similar Messages

  • LR rotates images as they were at the upload

    Hi everybody
    I went back to a folder I haven't been looking for about 3-4 months. After I located the folder from the external disk all the images opened,  with my surprise, without the rotation I have set at the time so I had to to do it all again. Usually LR should retain the settings you apply to images, with no time limitation. So what happened in this case?
    p.s. it's even worse: LR is opening the images, in Grid View, initially with the rotation I set after the first opening but as I scroll down, always in Grid View, the images showed in the screen are rotated back as they were at the upload.
    Then I scroll down a bit more, images that were out of view are showed with the correct rotation and after a while they start rotating as they were at upload .....what the hell is going on???

    I think the key is when you said you have not viewed these pictures in 3-4 months. Therefore LR deleted its previews and the effect you are seeing is LR re-making them. If it does not have a preview in its cache it tries to be quick by showing you the JPG preview in the image file. That's as the camera recorded it. The it makes a preview from the image data, and finally applies the editing steps either from the catalog or the XMP information in the file.
    So if you give LR the time to do all that it should give you the pictures as you last had them in LR.
    I just went back to some pictures from February in my catalog and LR did recall the image orientations.
    BUT - I am also confused. I did a test and rotated a picture in LR. That rotation did not appear in the History panel. That surprised me, because LR does remember any rotations applied. I don't know where.
    Another factor may be that many cameras record the orientation in the EXIF. Thus my Canon DSLR rotates images correctly on the LCD display whereas my Nikon Coolpix P6000 does not. This could be part of your issue:- the camera's notion of orientation vs. LR's.
    So this is only a partial answer but I hope it helps.

  • My Rotated Images Do Not Save.

    I just processed my entire photography collection with Bridge. I rotated many of the photos. But now, as I'm looking at the folders in Windows Explorer, I notice that none of the images appear as being rotated.
    After reading the product support for rotating images in Bridge: "Rotating does not affect the image data; however, rotating an image in Adobe Bridge may rotate the image view in the native application as well."
    This is bad. Very bad. I do not want to go through ALL of my photos again and re-rotate them in another app. Is there any way for the rotations I made in Bridge to be saved to the image data?

    This is from Adobe:  Although Bridge allows you to quickly and easily rotate images, the rotation doesn't really happen until you open the file up in a graphics application such as Adobe Photoshop® or Adobe Illustrator® and save it in it's rotated state. So if you rotated an image in Bridge and then dragged it into Adobe InDesign®, it would appear with its original orientation.
    So with the above in mind seems like you can use the Image Processor in Bridge to open images in PhotoShop then save it.  It should be then rotated.    Since you are not adding anything the non-rotated images would remain unrotated so you don't have to know which ones were rotated and which ones were not.
    Or am I out to lunch?

  • Rotated images in timeline

    How does Premiere Elements work?
    I have rotated images that have been shot at different orientations in the Organizer.
    When I insert these images into the timeline in Elements 9 the image reverts to its former orientation.
    I thought the orientation would be preserved when copying from Organizer.
    David

    David,
    Most image viewers, like Organizer, do not initially actually Rotate an image, but just add instructions to the metadata, indicating how to display the image. One must do a Save/Save_As to actually affect the pixels. This process differs, depending on the viewer used. In Bridge (the big-brother to Organizer, and shipping/installing with PS, AI, PrPro, InDesign, AE), one just does a Save/Save_As, depending on whether one wishes to physically overwrite the existing image. Then, the pixels are actually re-arranged. Not sure exactly how (or if) PrE's Organizer handles the physical re-arrangement of the pixels.
    PrE (and PrPro) will read the pixels, and not the metadata for the display.
    In the NLE (Non Linear Editor) programs, one would follow Neale's advice, and use the fixed Effect>Rotation.
    Good luck,
    Hunt

  • Help needed after uploading photos to my PC and being unable to rotate images and video

    HELP!!
    When I connect my iphone to my PC it imports all pics and video. Then when I go into the folder located where these images are located in my C drive and I want to rotate a photo (and video) that was taken upright on my iphone, I get a warning message stating "you cannot rotate this image. The file might be in use or open in another program or the file or folder might be read only"
    How do I edit and rotate these photos and videos so I can actually use them on my PC???
    Thank you!!!

    Yes, due to Incomplete Software Update on your iPhone your Device is now in Recovery Mode and you cannot take a Backup now. But if you have taken a backup earlier then you can Restore that backup on your iPhone after you Reset your iPhone to Factory Settings.

  • 360 degree rotate image mouse drag edge tutorial

    360 degree rotate image mouse drag edge tutorial and give edge file

    My thoughts would be to, use an event listener for mouse
    down.. then depending on where the mouse is down have it create
    another event listener for mouse move, for example if the mouse x
    and y was in the range of where you want.. And after that in the
    mouse move function create a tween depending on where the mouse x
    or why moves to.
    private function mouseDOWN(evt:MouseEvent):void{
    //if mouse x or y is in the position rang wanted, create the
    event listener for mouse movement and mouse up.
    private function mouseMOVED(evt:MouseEvent):void{
    //if mouse y moved from original position, figure out the
    difference
    // create a tween on the object's original location, and
    addition of the difference.
    private function mouseUP(evt:MouseEvent):void{
    // remove all of the event listeners to stop all
    interaction. Also removing the mouse up listener.
    hope this helps

  • Rotated image overlaps other controls

    Hi, I am working on an AIR app involving images. One of the functionalities is viewing as well as rotating images. I made a simple test app to illustrate this portion:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
        <mx:Script>
            <![CDATA[
                private function rotate():void
                    var bitmap:Bitmap = Bitmap(img.content);
                    var matrix:Matrix = bitmap.transform.matrix;
                    var centerX:Number = bitmap.width/2;
                    var centerY:Number = bitmap.height/2;
                    matrix.translate(-centerX, -centerY);
                    matrix.rotate(90*Math.PI/180);
                    matrix.translate(centerY, centerX);
                    bitmap.transform.matrix = matrix;
            ]]>
        </mx:Script>
        <mx:Text width="100%" text="Some text"/>
        <mx:Image id="img" width="100%" height="100%" source="test.jpg" horizontalAlign="center" verticalAlign="middle"/>
        <mx:Button label="rotate 90" click="rotate()"/>
    </mx:WindowedApplication>
    The application window has text on the top and a button on the bottom, with the image in the middle. Each click of the button rotates the image by 90 degrees.
    On launch, the app works great. It fetches the image file and fits it to the Image container. As I resize the application, the image also resizes and maintains the position relative to the other controls. Top text and bottom button are where they should be. All good. Let's assume the image is landscape/wide. After I perform the rotate 90 degrees by clicking the button, although the image is rotated and now in portrait orientation, the bottom portion of the image is now out of the image boundary and overlapping the button.
    Is there a way to tell the image to fit the content to the container again? Basically, re-layout the whole thing as if the image is in this new orientation.
    I suppose I can try to figure out a change in scale and resize the image, but I am not sure if this will hold when the user resizes the application. Also, the rotated image is now rather far to the left, as the "top left" corner is where a landscape image would be. For a portait orientation that's centered horizontally, it should be further to the right. I suppose I can also come up with some formula to center the rotated image. It just seems that the application already has all this logic built in, as it did exactly what I wanted when the image was loaded initially. If I can just ask the application to do it again. Note that similar issue occurs if the image starts out in portrait orientation and is rotated to landscape (too far to the right).
    Thanks in advance for the help.
    Will

    Thanks Sheila and Arnis,
    Today I opened the project to try different zoom settings and the problem has vanished; I get the correct arrow at zooms of 100, 120 and 140%.
    Likely a bug somewhere deep in Frame's innards. Anyway we've ordered TCS3 so soon I'll be using FM10. Thanks anyway.
    --- Derek

  • Is there a way to rotate images in iPhoto on the ipad

    I take photos with the iPhone or iPad and unless I sync them back to the Mac, there does not seem to be a way to rotate images. This makes having a nice slideshow (for the unlock screen) a problem as a bunch of images are all sideways. I'd like to be able to do simple edits like this in the device and not have to sync back and forth.

    You can't in the Photos app itself, though there are third-party apps that allow you e.g. PS Express (though the saved rotated version of the photo will be put in the Saved Photos album).

  • I have a Flash Sample to rotate images and text but I not find a way to display special characters

    Hello everyone.
    I bought a very nice Flash application that rotate images, and text of any color and size. It use an XML input file.
    I've posted here, a complete copy, so any of you can download, view and use it freely.
    I would appreciate if any of you know how to do, so that the text displayed, including the characters I use in my language (Spanish), such as á, é, í, ó, ú, ñ, and other special characters.
    In fact, I could not find a way to do it, because I'm not expert Flash, and less in ActionScript.
    If any of you would help me on that, I thank you implement the appropriate adjustments and compressed into a. zip file, and let me know where to download it, or if you prefer you can send it to my email: [email protected]
    After all compressed in .zip format is a very small file: 430K.
    Click here to download the complete sample.
    Thanks.
    =====================================
    Translated using http://translate.google.es
    =====================================

    Hello Rinus,
    If I understood your last post correctly, then problem 2 is resolved, right?
    Regarding problem 3:
    I'm not asking you to share exact VIs.
    I just want to see a very simple VI that explains the concept of what you're trying to do, what should happen (this can be in words that refer to the front panel elements) and what you've tried.
    The terminology you're using isn't clear to me without an extra explanation.
    This could even be only a Front Panel with a few buttons on where you just describe what should happen with specific controls/indicators.
    Based on the first post it is not clear to me what you mean with:
    - A "button element":
      Are you talking about a control, an indicator, a cluster that contains multiple control?
    - The structure:
      Is this an event structure, case structure, for loop, ...?
    Is it seems like you want to programmatically control Front Panel objects, which on itself is no problem at all independent of how many objects you want to control.
    Please share with me simple example of what goes wrong and explain which things should happen on that specific Front Panel.
    This will allow me to help you and also allow me to guide you along the right path.
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • Problem with rotating images in Photoshop CC

    When I rotate images in Photoshop CC I get jagged edges and not smooth as before. What has changed? How can I sort this out? Is my software corrupted?  Still works perfectly in CS3.

    If your using Free Transform, then look at the Interpolation settings in the tool options bar
    Try one of the Bicubic settings
    (i have it set to Bicubic)
    For rotating the Canvas look at the Image Interpolation settings under Photoshop (Edit)>Preferences>General and use one of the Bicubic settings
    The standard Bicubic setting is a good all around setting

  • I can't rotate images or text with two fingers on my trackpad.

    I have the most recent version of Keynote, using iOS 10.9.1 and a bluetooth trackpad.  Everything was working fine with the various gestures and now the rotation (two finger twisting) won't rotate images or text boxes.  Anybody else having this issue?  Any fixes you've seen that work?
    I've turned my bluetooth trackpad on/off.  I've checked my trackpad preferences checked/unchecked/checked.  Nothing seems to work.

    give gesture back please as soon as possible!!!

  • Rotating Image with Fade Effect

    Ok looking to rotate an image with a fade effect; below is a rotating image code.
    (Wanting this effect to be transitional and smooth. Transparency? Opacity?)
    <script language="JavaScript">
    <!--
    function adArray() {
    for (i=0; i*2<adArray.arguments.length; i++) {
    this[i] = new Object();
    this[i].src = adArray.arguments[i*2];
    this[i].href = adArray.arguments[i*2+1];
    this.length = i;
    function getAdNum() {
    dat = new Date();
    dat = (dat.getTime()+"").charAt(8);
    if (dat.length == 1)
    ad_num = dat%ads.length;
    else
    ad_num = 0;
    return ad_num;
    var ads = new adArray(
    "img1.jpg","http://www.domain.com",
    "img2.jpg","http://www.domain.com",
    "img3.jpg","http://www.domain.com");
    var ad_num = getAdNum();
    document.write('<div align="center"><A HREF="'+ads[ad_num].href+'" target="_blank"><IMG SRC="'+ads[ad_num].src+'" '
    +'BORDER=0 name=js_ad></A></div>');
    link_num = document.links.length-1;
    function rotateSponsor() {
    if (document.images) {
    ad_num = (ad_num+1)%ads.length;
    document.js_ad.src = ads[ad_num].src;
    document.links[link_num].href = ads[ad_num].href;
    setTimeout("rotateSponsor()",4000);
    setTimeout("rotateSponsor()",4000);
    // -->
    </script>
    Any ideas?

    Here is the script I finally got working! It would have not came to me without your help guys!
    <script>
    var pictureWebPartName="Pictures"; // name of the picture library web part
    var showThumbnails = true; //otherwise show full sized images
    var randomImg = true; //set to true to show in random order
    var useCustomLinks = false; //true to use second column as URL for picture clicks
    var RotatingPicturesLoopTime = 5000; //2000 = 2 seconds
    var imgToImgTransition = 1.0; //2 = 2 seconds
    // don't change these
    var selectedImg = 0;
    var imgCache = [];
    var imgTag;
    function RotatingPictures()
    imgTag = document.getElementById("RotatingImage");
    //Find the picture web part and hide it
    var Imgs = [];
    var x = document.getElementsByTagName("TD"); // find all of the table cells
    var LinkList;
    var i=0;
    for (i=0;i<x.length;i++)
    if (x[i].title == pictureWebPartName)
    // tables in tables in tables... ah SharePoint!
    LinkList = x[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
    // hide the links list web part
    LinkList.style.display="none";
    break;
    if (!LinkList)
    document.all("RotatingImageMsg").innerHTML="Web Part '" + pictureWebPartName + "' not found!";
    //Copy all of the links from the web part to our array
    var links = LinkList.getElementsByTagName("TR") // find all of the rows
    var url;
    var len;
    for (i=0;i<links.length;i++)
    //if (links(i).id.match("row")!=null)
    if (links[i].childNodes[0].className=="ms-vb2")
    len=Imgs.length
    Imgs[len]=[]
    Imgs[len][0] = links[i].childNodes[0].childNodes[0].href;
    if (useCustomLinks)
    if (links[i].childNodes[1].childNodes.length>0)
    { Imgs[len][1] = links[i].childNodes[1].childNodes[0].href; }
    else
    { Imgs[len][1] = "" }
    if (Imgs.length==0)
    document.all("RotatingImageMsg").innerHTML="No images found in web part '" + pictureWebPartName + "'!";
    for (i = 0; i < Imgs.length; i++)
    imgCache[i] = new Image();
    imgCache[i].src = Imgs[i][0];
    if (useCustomLinks)
    imgCache[i].customlink=Imgs[i][1];
    RotatingPicturesLoop();
    // now show the pictures...
    function RotatingPicturesLoop()
    if (randomImg)
    selectedImg=Math.floor(Math.random()*imgCache.length);
    if (document.all){
    imgTag.style.filter="blendTrans(duration=" + imgToImgTransition + ")";
    imgTag.filters.blendTrans.Apply();
    url=imgCache[selectedImg].src
    if (useCustomLinks)
    { RotatingImageLnk.href=imgCache[selectedImg].customlink; }
    else
    { RotatingImageLnk.href = url; }
    if (showThumbnails)
    // convert URLs to point to the thumbnails...
    // from airshow%20pictures/helicopter.jpg
    // to airshow%20pictures/_t/helicopter_jpg.jpg
    url = revString(url);
    c = url.indexOf(".");
    url = url.substring(0,c) + "_" + url.substring(c+1,url.length);
    c = url.indexOf("/");
    url = url.substring(0,c) + "/t_" + url.substring(c,url.length);
    url = revString(url) + ".jpg";
    imgTag.src = url;
    if (document.all){
    imgTag.filters.blendTrans.Play();
    selectedImg += 1;
    if (selectedImg > (imgCache.length-1)) selectedImg=0;
    setTimeout(RotatingPicturesLoop, RotatingPicturesLoopTime);
    // utility function revString found here:
    // http://www.java2s.com/Code/JavaScript/Language-Basics/PlayingwithStrings.htm
    function revString(str) {
    var retStr = "";
    for (i=str.length - 1 ; i > - 1 ; i--){
    retStr += str.substr(i,1);
    return retStr;
    // add our function to the SharePoint OnLoad event
    _spBodyOnLoadFunctionNames.push("RotatingPictures");
    </script>
    <!-- add your own formatting here... -->
    <center>
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td id="VU" height="125" width="160" align="center" valign="middle">
    <a name="RotatingImageLnk" id="RotatingImageLnk" alt="click for larger picture">
    <img src="/_layouts/images/dot.gif" name="RotatingImage" id="RotatingImage" border=0>
    </a>
    <span name="RotatingImageMsg" id="RotatingImageMsg"></span>
    </td>
    </tr>
    </table>
    </center>
    Thanks again guys!

  • How to auto rotate Images on Full Screen Slideshow if pictures were taken mixed Portrait and Landsca

    In Muse: How to auto rotate Images on Full Screen Slideshow if pictures were taken mixed Portrait and Landscape

    There is no way that Muse would automatically rotate the images. What you can instruct Muse to do is whether you want to show all image content and leave blank space in either direction OR scale the image to fill the frame resulting in some cropping, but filling the otherwise blank space.
    The options are Fit Content Proportionally and Fill Frame Proportionally respectively.
    Cheers,
    Vikas

  • Severe memory leak in LR5 (CC release v5.0) when cropping (rotating) images

    I have a Quadcore i7 iMac with 12GB of memory.  When I start LR5, there is 8GB remaining.  With nothing else being done, as a edit some images, and especially when I am rotating images in the crop tool to level the horizon, fI sometimes get the "OSX beachball" and the memory immediately drops from 8GB to 10-20MB!!!  The disk goes crazy and LR5 and the entire machine slows to a crawl.  The only way to bring it back is to Force Quit LR5.  But this has happened with the same picture twice already and am getting ready to try #3.
    Please fix this .... this is definitely a bug as there is no reason it should eat 8GB of memory for doing an image rotate.

    There are a number of bugs that have been logged against crop/roate in Lr5. The engineering team are currently working to fix these.

  • Rotating Images in a grid or canvas

    I want to build a component somewhat similar with the
    rotating images that you can see below.
    http://www.istockphoto.com/index.php
    Thanks in advance,
    Q

    Here is a place to start:
    http://weblogs.macromedia.com/pent/archives/2007/10/component_class_2.cfm
    Tracy

Maybe you are looking for