ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEnView JPEG with EXIF auto rotation
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

orionmcdeath

United Kingdom
1 Posts

Posted - May 22 2019 :  11:57:55  Show Profile  Reply
Hopefully someone can give me a better solution to this little issue I am having with EXIF information embedded into an image.

I have noticed that some images will auto rotate when displayed due to the ImageEnView.IO.Params.EXIF_Orientation

This is great and i would expect is what most people want. However in my case I not only want this auto rotation to happen but when i save the jpeg out using ImageEnView.IO.SaveToStream I would like it to save to disk auto corrected, however it saves it to disk as it found it (again, I am sure most people would want it this way).

I could use the EXIF_Orientation information to tell me the orientation and do the work manually but I have been trying to find something more automated than that. (I want to save it to disk corrected as my delphi windows application has image rotation functionality and EXIF clashes with it when I save to disk)

The only way I have found thus far is to save the image using the ioBMP flag which saves it to disk auto corrected, however I want to keep the original image format which is jpeg but if I save it out as ioJPG it saves the image to disk without the auto correction.
I could say, what the hell, save it to a stream as a bitmap and then convert it to a jpeg and save to disk but there must be a better way.

Does anyone know how I can save the file out to disk as a jpeg with the auto correction using ImageEnView.IO.SaveToFile as it would if I saved it as a bmp with ioBmp flag?

Regards
Mick.








nosce te ipsum

xequte

38176 Posts

Posted - May 22 2019 :  15:54:51  Show Profile  Reply
Hi Mick

If ImageEnView1.IO.IOParams.EnableAdjustOrientation is enabled then ImageEn will automatically rotate the image on loading and update the EXIF data to show it is correctly orientated.

From that point on, it does not know about the original orientation, so if you save it will be saved with the new (correct) rotation and EXIF data.

IOW, if you use EnableAdjustOrientation there is no method to rotate it back to its old orientation when saving.

If you want that functionality then you'll need to write your own code to read the EXIF orientation field and rotate appropriately. Then store information about the change to correct it at save time. The code is actually quite simple.


Nigel
Xequte Software
www.imageen.com


REF: https://www.imageen.com/help/TIOParams.EnableAdjustOrientation.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: