Jump to content
coronatuss

HELP with image orientation (Rotation direction and grades)?

Recommended Posts

Hello everyone,

Im developing an script to check the size of all .jpg stored in windows folder.

The problem is that it doesn´t work properly with rotated images. 

With _GDIPlus_ImageGetWidth() and _GDIPlus_ImageGetHeight()  I get the Width and Height of images as if they had not been rotated, and I need to know how they are rotated (orientation and grades).

Any help is welcome! If more info is needed, please tell. 😁

Share this post


Link to post
Share on other sites

Thanks Sidley,

Is on Windows 10. 

I have tried what you have told me and the script does not return the orientation, although it does return other interesting properties.

I'm still looking for the solution.

Share this post


Link to post
Share on other sites

Apparently Windows 8/10 handles image rotation differently than previous versions, it makes use of the Exif orientation flag. It may be the case that the image dimensions are landscape, but the exif rotation is at say, 90 degrees. Therefore the image appears to be portrait, but the actual dimensions are still landscape. Then again, I could be talking out of my arse, maybe someone can confirm this?

 

https://jdhao.github.io/2019/07/31/image_rotation_exif_info/

Share this post


Link to post
Share on other sites

 

1 hour ago, Sidley said:

Apparently Windows 8/10 handles image rotation differently than previous versions, it makes use of the Exif orientation flag. It may be the case that the image dimensions are landscape, but the exif rotation is at say, 90 degrees. Therefore the image appears to be portrait, but the actual dimensions are still landscape. Then again, I could be talking out of my arse, maybe someone can confirm this?

 

https://jdhao.github.io/2019/07/31/image_rotation_exif_info/

Hi @Sidley,

I think you are right. It is exactly what is happening to me.

Even though the image is rotated, I always get the original dimensions, ignoring the current orientation.

 

29 minutes ago, KaFu said:

Here's some code I've ripped from my SMF program.

Image_Get_Orientation.zip 9.5 kB · 2 downloads

Excellent @KaFu.

With this we can obtain the current orientation of the images.

I see that it doesn't work with all ".jpg". Much information is obtained from some images, but in other images the information is reduced, and the orientation may be missing. It should be a thing of every image.

Thanks to both of you!! 😁

Share this post


Link to post
Share on other sites
11 minutes ago, coronatuss said:

I see that it doesn't work with all ".jpg". Much information is obtained from some images, but in other images the information is reduced, and the orientation may be missing. It should be a thing of every image.

Are you sure that those images have EXIF information at all? No EXIF info will result in a blank return.

Share this post


Link to post
Share on other sites
On 6/24/2020 at 12:48 PM, KaFu said:

Are you sure that those images have EXIF information at all? No EXIF info will result in a blank return.

They have EXIF info, but "Orientation" is missing in some of the images.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Gowrisankar
      Dear members of the forum,
      I'm working on a project in which I have to use Image recognition technique. 
      Due to client restrictions, I couldn't use AutoIt for this project. 
      Is there a way to use this DLL "ImageSearchDLL.dll" (which is used to do image recognition steps in AutoIt) in VB.Net to achieve the same result? 
      I have used this DLL few years before and got good results. If there is a latest version of this DLL and if you can share it, that will be helpful too.
      Any guidance is deeply appreciated.
    • By amosrinat
      Hi,
      i have an AutoIT script that sends emails with two embedded images.
      When users get the email they don't see the images. How should I fix my code?
      Thank you for your support,
      Amos
      Func fSendMail() $TemplateName = StringRegExpReplace($Template, "^.*\\|\..*$", "") $SmtpServer = "smtp.**.com" $FromName = "do-not-reply@*********" $FromAddress = "do-not-reply@******" $ToAddress = $MG1_Mgr & ";"& $Owner $Subject = "ACTION REQUIRED - " & $TemplateName $Body = $sBody5 $IPPort = 25 $ssl = 0 Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = fINetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $IPPort, $ssl) If @error Then MyErrFunc() EndIf EndFunc;fSendMail Func fINetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort $objEmail.Configuration.Fields.Update $objEmail.Fields.Update ;$objEmail.Send **************** If @error Then MyErrFunc() EndIf $objEmail = "" EndFunc;fINetSmtpMailCom  
    • By nacerbaaziz
      hello autoit team
      please i've a question for you.
      am creating a audio player
      and in this audio player i want to show the current trac info
      such as the total time and the position ... etc
      i know i can show it as label
      but the screen reader for the blind read the text every change
      because it have a screen scan
      what i want is to show this informations but such image or icon
      i mean i need to create
      GUICtrlCreatepic or GUICtrlCreateicon ....
      or some thing as that
      and show this informations as image on it
      i think that i can do that with the 
      _GDIPlus functions
      but i couldn't find the currect way to do it
      i tried the _GDIPlus_GraphicsDrawString
      but i couldn't know how it work
      what i need is a small example that create a GUI
      and add a multy line text to it as graphic or image.
      so i need a simple way because it will changed every sec
      i hope any one can help me to do that
      global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc  
    • By therks
      So I don't have any code cooked up yet as this is still in the theoretical stage. Just looking for some advice.
      My current idea is to resize the image to 1x1 pixel, probably using _GDIPlus_ImageResize, and read the color of the resulting pixel to obtain an admittedly very general sense of brightness. Does anyone think this could work?
      We have a CCTV system running at home using some home made cameras (raspberry pi) and we're trying to automate toggling settings for day/night time. We started with an AutoIt script that checked sunrise and sundown times for our location (calculations pulled from here) and toggled the settings based on that. Unfortunately our weather varies wildly, so it can get light/dark far outside normal sunrise/sundown times. Now we're hoping to periodically grab a still from the camera and toggle the light mode based on that.
×
×
  • Create New...