I have an application that takes in images, but something it can't handle are images with an orientation of rotate 180. So for images that are upside down with the wrong orientation tag (horizontal normal), when I try to change the meta data to rotate 180, it flips to the correct orientation, but has the wrong meta data and so cannot be processed by my application. Any help would be appreciated.
What is the command you are using? What is the "wrong metadata"? What is the program you are using that can't read the data? What type of file?
You're not giving us any useful information.
Exiftool writes data according to the various standards and if just changing the Orientation tag means your other program can't read it, then that program isn't following the standards.
Quote from: StarGeek on July 24, 2023, 08:58:41 PMWhat is the command you are using? What is the "wrong metadata"? What is the program you are using that can't read the data? What type of file?
You're not giving us any useful information.
Exiftool writes data according to the various standards and if just changing the Orientation tag means your other program can't read it, then that program isn't following the standards.
I believe that I that I gave all of that information. The files are images (jpgs normally), and the wrong meta data is that it says that the orientation is horizontal normal even though it is an upside down picture. I am just using exiftool -Orientation to check it. That is indeed the issue, I literally said that the program is not following standards and so I was asking for a solution.
Quote from: deomonizer on July 27, 2023, 04:00:56 PMthe wrong meta data is that it says that the orientation is horizontal normal even though it is an upside down picture.
Try setting the
Orientation to "Rotate 180"
exiftool -Orientation="Rotate 180" /path/to/files/
Quote from: StarGeek on July 27, 2023, 05:08:11 PMQuote from: deomonizer on July 27, 2023, 04:00:56 PMthe wrong meta data is that it says that the orientation is horizontal normal even though it is an upside down picture.
Try setting the Orientation to "Rotate 180"
exiftool -Orientation="Rotate 180" /path/to/files/
Thanks for trying to help. Like I said, setting it to rotate 180 does set it to the right orientation, but my application cannot ingest rotate 180 images. Is there a way to completely reset the orientation?
There's nothing to reset. If your program refuses to honor the Orientation tag, then there's nothing exiftool can do. This is a problem with the program you're using.
Jpegs can be losslessly rotated as long as the image dimensions are divisible by 16 or sometimes 8, depending upon the image's MCU block (Minimum Coded Unit). On the command line, there's a program called JpegTran which can do this. There are also plenty of programs based upon the JpegTran code that can do lossless rotation. There are some examples on the JPEG wikipedia page (https://en.wikipedia.org/wiki/JPEG#Lossless_editing). For example, on Windows you can use Irfanview with the lossless jpeg plugin.
(https://i.imgur.com/6um43qr.png)
Quote from: deomonizer on July 27, 2023, 06:52:00 PMQuote from: StarGeek on July 27, 2023, 05:08:11 PMQuote from: deomonizer on July 27, 2023, 04:00:56 PMthe wrong meta data is that it says that the orientation is horizontal normal even though it is an upside down picture.
Try setting the Orientation to "Rotate 180"
exiftool -Orientation="Rotate 180" /path/to/files/
Thanks for trying to help. Like I said, setting it to rotate 180 does set it to the right orientation, but my application cannot ingest rotate 180 images. Is there a way to completely reset the orientation?
As Stargeek suggested, try physically rotating the file, something like:
jpegtran -rotate 180 original.jpg > rotated.jpg
but check the syntax of this command!