Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Picture Rotation

If the image width is smaller than the the height the picture is displayed sideways (rotated 90 deg). How can I get the image to be displayed with the correct rotation, that is the correct way up.
«1

Comments

  • Would you mind sending the picture to us? Maybe your setup code for the Picture control? I've never witnessed this behavior before, and we use pictures of that proportion all the time.
  • edited August 2016
    Don't mean to hijack this post but here's an observation that may or may not help



    It's the same control just a different image
  • To add further to the problem, I found that a large image (6mb 2988x5312) has the rotation issue. Resizing the same image (Height > width) to 1/10th solves the issue. Also found the same problem exists when setting a bitmap in OI so I assume the issue is an OI problem but also manifests itself in the picture control.
  • Chris - Thanks for the sample image. We'll test shortly and get back to you. Did you test all of the images that are giving you problems in OI's bitmap control? I'm curious to know if this is really a more fundamental problem versus a problem within our library.

    Mark - Are the images you are using in your screen shots particularly large? If not, can you send those along as well to support@srpcs.com? It seems odd (to me at least) that this has never been reported before. The SRP Picture control is used routinely in our apps. Also, have you tested these images with the OI bitmap control?
  • Don,
    Yes I did test in the OI bitmap control and got the same result. When I reduced the size of the image (1/10th), the image displayed correctly. I reduced the size of the image using paint.net.
    Did you want a copy of the reduced image? Just let me know.
  • Chris - Thanks for the response. I was really trying to establish that the problem manifests itself in OI for all images you've observed having the rotation issue. I've already taken the image you sent me and re-saved it with the same dimensions. The file size got reduced by half and OI now displays it okay. I'm not yet convinced it is a size issue. See further below for my thoughts.

    The fact that OI and our control exhibit the same behavior is definitely relevant. We are not yet convinced that OI is the culprit but perhaps OI and our controls share the same root problem. We are researching this now to see what might be the issue. My current (yet somewhat unqualified) opinion is that this has more to do with properties within the image metadata than with size of the image. I suspect newer images are passing in data that older libraries (such as OI's and ours) might not know how to handle properly. This is why I'm interested in getting Mark's images or any other image that replicates the problem.

    One final question...you said the rotation is 90 degrees. In Mark's screen shots and in my tests I am showing a -90 degrees (270 degrees, or counter-clockwise) rotation. Can you confirm that this what you are seeing?
  • The issue is this: JPEGs sometimes have metadata (also called EXIF metadata) that is attached to the image when the camera takes a picture. Modern cameras have sensors to determine the orientation of the camera, and that orientation is saved with the image. Only as of Windows 8 are these images auto-rotated, which makes you think the image is actually saved the way it appears in Windows Explorer. It's not. OpenInsight and the SRP Picture Control are loading the picture in its saved orientation.

    Saving the image to be smaller had nothing to do with fixing the image. Instead, Paint.NET or SnagIt load the image auto-rotated and save the image in the new orientation minus the metadata.

    Download and re-register SRPControls 4.0.2 RC4 and try it. The SRP Picture Control should now auto-rotate the JPEG according to it's Orientation metadata tag.
  • I just noticed that the rotation was incorrect in 4.0.2 RC4. After further study, there is a complicated list of operations, sometimes both a rotation and a flip is needed. SRPControls 4.0.2 RC5 should be correct.
  • Oh, gees! I can see this cleverness ultimately causing confusion when our application exports derivatives of images for use by other applications, which may or may not support this feature. Would there be properties in the new SRPcontrols to examine and control this behavior?

    Cheers, M@
  • I have just loaded and registered the new SRPControls.ocx and that fixed the rotation problem, but OI crashed and get "OI stopped working" every time I close the main MDI. Put the previous version back and now does not crash.
  • Matt - For the time being, there will not be a property to disable this. Even though it's metadata, technically, a JPG with the orientation flag means the image is supposed to be rotated. That's the proper way to load it. Since it only happens with JPGs, I don't see this leading to much confusion unless people open the JPG in other legacy software.

    Chris - I'm afraid I don't see this behavior in my copy of OI, but I'm only testing the Picture control. Perhaps something else is crashing, but I don't have enough to go on at this point.
  • The MDI has a ribbon control, maybe that is causing the problem.
  • Chris,

    Try putting a hidden ole for srp picture on the mdi window.
    Just something I found I had to do for srp popup use.
  • I have just installed the latest srpcontrols.ocx and now get a message "Oinsight has stopped working" and crashes when I close the main MDI which has a ribbon control . Had to reinstate the previous version dated 12 Jul 2016 (17,534Kb)
  • Chris - Is this all you have to report? This seems like the same information you shared a couple weeks ago. I'm not sure what else we can do for you without more information or a copy of your system to test with.
  • edited September 2016
    Yes I reported a couple of weeks ago but I thought this latest version (17,685Kb) may have fixed the problem since it is a different size to any previous version. I will investigate further to locate exactly where OI is stopping. The version that works is 17,534Kb the versions that crash are 17.542Kb and 17,685Kb in size.
  • edited September 2016
    I have tracked it down to:
    Send_Message(Ole_Ribbon$, "OLE.Init", SetupXml)
    If I comment the above statement the ribbon is not displayed but the close button (the X in the top right hand corner) does not crash OI. Is there any other information that may help diagnose the problem.
    Sorry, misled you. There is something else causing the problem because when I commented a large chunk of other ribbon statements and the above statement is not causing the problem.
  • Chris - It might be unique to your XML init string. Can you send that to support@srpcs.com? We have to use the same method to initialize our Ribbon control so there is something different between our environments.
  • I have tracked it down to the following statements:
    *** Now embed the window to be displayed in the backstage page
    NewWindow = Start_Window("PBC_ABOUT")
    Handle = Get_Property(NewWindow, "HANDLE")
    Send_Message(Ole_Ribbon$, "OLE.EmbedWindow", "PBC_BS_PAGE", Handle)
    NewWindow = Start_Window("PBC_RIBBON_THEME")
    Handle = Get_Property(NewWindow, "HANDLE")
    Send_Message(Ole_Ribbon$, "OLE.EmbedWindow", "MDI2015_PAGE_BS_THEME", Handle)

    Hope this helps.
  • Do either of those windows have the SRP Picture control on them?
  • edited September 2016
    Ok. This is what needs to be commented to avoid the crash:
    * NewWindow = Start_Window("PBC_RIBBON_THEME")
    * Handle = Get_Property(NewWindow, "HANDLE")
    * Send_Message(Ole_Ribbon$, "OLE.EmbedWindow", "MDI2015_PAGE_BS_THEME", Handle)
    *
    Remember it is closing the MDI that causes the crash, not when the above statement is executed.

    I am using the latest version of Windows 10 on a Microsoft Surface Book.
  • Does PBC_RIBBON_THEME have the SRP Picture control being used?
  • I do not think to. Remember the problem was in the previous SRPControls.ocx before the picture control was changed.
    The ribbon theme form is a simple form with radio buttons setting various themes so I am somewhat surprised this is causing the problem. I will investigate further.
  • Sorry but it is not just the PBC_RIBBON_THEME but both the PBC_ABOUT and the PBC_RIBBON_THEME .
  • edited September 2016
    There are 2 instances of "OLE.EmbedWindow". Either one is causing the problem, so I assume the problem is closing embedded windows.
  • I do not think to. Remember the problem was in the previous SRPControls.ocx before the picture control was changed.
    Yes, I remember.
    The ribbon theme form is a simple form with radio buttons setting various themes so I am somewhat surprised this is causing the problem. I will investigate further.
    I'm surprised as well...which is why I'm looking for additional bits of relevant details.
    Sorry but it is not just the PBC_RIBBON_THEME but both the PBC_ABOUT and the PBC_RIBBON_THEME .
    Actually, this is what I expected (hence, I was surprised when you ruled one of them out but did not note the problematic one as running the SRP Picture control).
    There are 2 instances of "OLE.EmbedWindow". Either one is causing the problem, so I assume the problem is closing embedded windows.
    Yes, it would appear so in your case, but we still haven't identified the missing ingredient. Kevin's on holiday for a few days so he might not get a chance to respond until later next week. I'm doing the triage work to try and eliminate as many questions as possible that he might have. Perhaps he'll identify the root cause but I think we should anticipate getting an RDK from you that we can test with.
  • I've been embedding forms daily (using forms containing the SRP Picture control) for months now on a project. I also just tested multiple forms, but nothing crashed. This was with 4.0.2 RC11. An RDK that recreates the issue would help me isolating the cause and get a fix for you asap.
  • Hi Kevin,

    Ok - I've now got SRPcontrols v4.0.2.0 and rotated images are now showing the correct vertical orientation in SRP Picture control. However - I'm finding that images that explicitly have an Orientation tag of 'Horizontal (normal)' (value = 1), are showing flipped horizontally. Eg, the words are reversed in this image shown

    image

    Images with no Orientation tag are Ok.

    How feasible is a patch for this?? :)
    Cheers, M@
  • Oops. C++ indexes at 0. Yikes. Guess what. That means that, if a JPG with orientation 8 was ever used... crash. Could that explain your crash Chris? If so, mea culpa. I prostrate myself before you and beg your forgiveness.

    Download 4.0.3 RC1
  • Eeks! Well, the good news is that Orientation 1 now shows normally :). The bad news is that Orientation 6 (Rotate 90 CW) is now showing upside down! Have to laugh :)

    Cheers, M@
Sign In or Register to comment.