News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Rotation on jpg file

Started by fcb38, October 27, 2020, 03:56:47 PM

Previous topic - Next topic

fcb38

Hello,
I have a problem with photos created with my Samsung A71 when I use an old program called "CAM2PC".
This software is not able to put picture taken in "portrait" in a good way. Picture are always in "Landscape".
With another Smartphone it's OK (Xiaomi Redmi 4X).
Can you tell me where is writen the orientation of the picture in the following tags:

---- ExifTool ----
ExifTool Version Number         : 12.06
---- File ----
File Name                       : 2020-10-13_09-46-50 Puyvert 01.jpg
Directory                       : .
File Size                       : 2.8 MB
File Modification Date/Time     : 2020:10:17 15:48:44+02:00
File Access Date/Time           : 2020:10:27 20:54:08+01:00
File Creation Date/Time         : 2020:10:13 09:46:50+02:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Image Width                     : 3120
Image Height                    : 4160
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
---- EXIF ----
Camera Model Name               : Redmi 4X
Software                        : santoni-user 7.1.2 N2G47H V9.2.1.0.NAMCNEK release-keys
Modify Date                     : 2020:10:13 09:46:50
Y Cb Cr Positioning             : Centered
ISO                             : 100
Exposure Program                : Not Defined
F Number                        : 2.0
Exposure Time                   : 1/848
Sensing Method                  : Unknown (0)
Sub Sec Time Digitized          : 741177
Sub Sec Time Original           : 741177
Sub Sec Time                    : 741177
Focal Length                    : 4.1 mm
Flash                           : Off, Did not fire
Metering Mode                   : Unknown
Scene Capture Type              : Standard
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Focal Length In 35mm Format     : 0 mm
Create Date                     : 2020:10:13 09:46:50
Exif Image Height               : 4160
White Balance                   : Auto
Date/Time Original              : 2020:10:13 09:46:50
Brightness Value                : 0
Exif Image Width                : 3120
Exposure Mode                   : Auto
Aperture Value                  : 2.0
Components Configuration        : Y, Cb, Cr, -
Color Space                     : sRGB
Scene Type                      : Unknown (0)
Shutter Speed Value             : 1/847
Exif Version                    : 0220
Flashpix Version                : 0100
Resolution Unit                 : inches
GPS Img Direction Ref           : Magnetic North
GPS Latitude Ref                : North
GPS Img Direction               : 13
GPS Latitude                    : 43.760472°
GPS Longitude Ref               : East
GPS Longitude                   : 5.347853°
GPS Altitude Ref                : Above Sea Level
GPS Altitude                    : 249 m
GPS Time Stamp                  : 07:46:49
GPS Processing Method           : ASCII
GPS Date Stamp                  : 2020:10:13
X Resolution                    : 72
Y Resolution                    : 72
Make                            : Xiaomi
Thumbnail Offset                : 1086
Thumbnail Length                : 29183
Compression                     : JPEG (old-style)
Resolution Unit                 : inches
X Resolution                    : 72
Y Resolution                    : 72
Thumbnail Image                 : (Binary data 29183 bytes, use -b option to extract)
---- Composite ----
Aperture                        : 2.0
Image Size                      : 3120x4160
Megapixels                      : 13.0
Shutter Speed                   : 1/848
Create Date                     : 2020:10:13 09:46:50.741177
Date/Time Original              : 2020:10:13 09:46:50.741177
Modify Date                     : 2020:10:13 09:46:50.741177
GPS Altitude                    : 249 m Above Sea Level
GPS Date/Time                   : 2020:10:13 07:46:49Z
GPS Latitude                    : 43.760472° N
GPS Longitude                   : 5.347853° E
Focal Length                    : 4.1 mm
GPS Position                    : 43.760472° N, 5.347853° E
Light Value                     : 11.7


Regards.

PH Edit: Put output in a code block.

StarGeek

Just so you know, the ExifToolGUI no longer has support, as per the sticky thread in this sub-forum.

The output you list does not appear to contain an Orientation tag.  You could fix the problem files by adding either -Orientation="Rotate 90 CW" or -Orientation="Rotate 270 CW" in the ExifTool Direct part of the GUI.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Alan Clifford

QuoteImage Width                     : 3120
Image Height                    : 4160

The height is greater than the width so this photo is physically a portrait.

A portrait orientation tag is only required if the photo is physically landscape but should be displayed as a portrait.

StarGeek

Quote from: Alan Clifford on October 27, 2020, 05:10:51 PM
The height is greater than the width so this photo is physically a portrait.

Ah, missed that.  Good catch.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

fcb38

Hello,
It seems these "parameters" are File Tags. So I think it's impossible to modify them.
When I try I have this message:
QuoteWarning: Sorry, file:ImageWidth doesn't exist or isn't writable

Do you confirm that I can't modify these tags?

Phil Harvey

File:ImageWidth/ImageHeight are properties of the image itself.  ExifTool can not be used to modify the image data.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alan Clifford

The metadata posted was from the xiaomi which, we are told, does not have the problem.

It would be best to attach a photo from the Samsung for us to look at the metadata that is the problem.

fcb38

#7
Hello,

Here is a tags from a picture directly copied from my smartphone Samsung A71:

---- ExifTool ----
ExifTool Version Number         : 12.08
---- File ----
File Name                       : 20201028_152704.jpg
Directory                       : .
File Size                       : 5.7 MB
File Modification Date/Time     : 2020:10:28 15:27:04+01:00
File Access Date/Time           : 2020:10:28 15:27:25+01:00
File Creation Date/Time         : 2020:10:28 15:27:25+01:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Image Width                     : 4624
Image Height                    : 3468
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
---- EXIF ----
Image Width                     : 4624
Image Height                    : 3468
Make                            : samsung
Camera Model Name               : SM-A715F
Orientation                     : Rotate 90 CW
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : A715FXXU3ATI8
Modify Date                     : 2020:10:28 15:27:04
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/455
F Number                        : 1.8
Exposure Program                : Program AE
ISO                             : 32
Exif Version                    : 0220
Date/Time Original              : 2020:10:28 15:27:04
Create Date                     : 2020:10:28 15:27:04
Shutter Speed Value             : 1
Aperture Value                  : 1.8
Brightness Value                : 17.53
Exposure Compensation           : 0
Max Aperture Value              : 1.8
Metering Mode                   : Center-weighted average
Flash                           : No Flash
Focal Length                    : 5.2 mm
Color Space                     : sRGB
Exif Image Width                : 4624
Exif Image Height               : 3468
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 24 mm
Scene Capture Type              : Standard
Image Unique ID                 : A64QLMD01MM
Image Width                     : 640
Image Height                    : 480
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 774
Thumbnail Length                : 56425
Thumbnail Image                 : (Binary data 56425 bytes, use -b option to extract)
---- MakerNotes ----
Time Stamp                      : 2020:10:28 15:27:04+01:00
---- Composite ----
Aperture                        : 1.8
Image Size                      : 4624x3468
Megapixels                      : 16.0
Scale Factor To 35 mm Equivalent: 4.6
Shutter Speed                   : 1/455
Circle Of Confusion             : 0.007 mm
Field Of View                   : 73.7 deg
Focal Length                    : 5.2 mm (35 mm equivalent: 24.0 mm)
Hyperfocal Distance             : 2.32 m
Light Value                     : 12.2


Regards.

PH Edit: Put output in a code block.

Alan Clifford

A photograph would have been prefered.  Can you repost the output with the -a parameter.

Another thought.
Does your old software actually recognize the orientation tag?  You could test this by putting an orientation into that Xiaomi photo and seeing if the software recognizes it.  Use, for instance,
-orientation#=7
which should mirror it horizontally and rotate it.

StarGeek

Quote from: fcb38 on October 28, 2020, 10:33:21 AM
Here is a tags from a picture directly copied from my smartphone Samsung A71:

...
Orientation                     : Rotate 90 CW
...

Here is where the orientation is held.  This image needs to be rotated 90° clockwise in order to view the image correctly.

Just in case there's a misunderstanding, all digital cameras take the picture in landscape mode.  They all start out with a width>height.  The software that reads the image is supposed to read the above Orientation tag and used that information to rotate the image so it appears correct.  The data from the first image you posted has been rotated by some program, which can be rotated in a destructive manner which loses some image data (rotate and resave) or it can be rotated in a non-destructive manner, usually listed as a Lossless Rotation.

If the image straight out the camera is not shown correctly, then you might want to check the options for the program you are viewing the image with for an auto-rotate setting.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

fcb38

Here is the result of the command "exiftool -a" on one file coming from my Samsung (re-compressed to be smaller) :


D:\Yvan\_SoftWare\Images\Exiftoolgui - portable>exiftool.exe -a 01.jpg
ExifTool Version Number         : 12.06
File Name                       : 01.jpg
Directory                       : .
File Size                       : 2.2 MB
File Modification Date/Time     : 2020:10:28 20:29:35+01:00
File Access Date/Time           : 2020:10:28 20:30:08+01:00
File Creation Date/Time         : 2020:10:28 20:29:34+01:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Image Width                     : 2000
Image Height                    : 3468
Make                            : samsung
Camera Model Name               : SM-A715F
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : A715FXXU3ATH8
Modify Date                     : 2020:10:13 10:26:40
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/1122
F Number                        : 1.8
Exposure Program                : Program AE
ISO                             : 32
Exif Version                    : 0220
Date/Time Original              : 2020:10:13 10:26:40
Create Date                     : 2020:10:13 10:26:40
Shutter Speed Value             : 1
Aperture Value                  : 1.8
Brightness Value                : 20.04
Exposure Compensation           : 0
Max Aperture Value              : 1.8
Metering Mode                   : Center-weighted average
Flash                           : No Flash
Focal Length                    : 5.2 mm
Color Space                     : sRGB
Exif Image Width                : 3468
Exif Image Height               : 4624
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 24 mm
Scene Capture Type              : Standard
Image Unique ID                 : A64QLMD01MM
Image Width                     : 480
Image Height                    : 640
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 774
Thumbnail Length                : 18382
XMP Toolkit                     : Adobe XMP Core 5.1.0-jc003
Micro Video                     : 1
Micro Video Version             : 1
Micro Video Offset              : 4097910
Micro Video Presentation Timestamp Us: -1
Image Width                     : 3468
Image Height                    : 4624
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Aperture                        : 1.8
Image Size                      : 3468x4624
Megapixels                      : 16.0
Scale Factor To 35 mm Equivalent: 4.6
Shutter Speed                   : 1/1122
Thumbnail Image                 : (Binary data 18382 bytes, use -b option to extract)
Circle Of Confusion             : 0.007 mm
Field Of View                   : 73.7 deg
Focal Length                    : 5.2 mm (35 mm equivalent: 24.0 mm)
Hyperfocal Distance             : 2.32 m
Light Value                     : 13.5

D:\Yvan\_SoftWare\Images\Exiftoolgui - portable>pause
Appuyez sur une touche pour continuer...

Alan Clifford

That one has a height greater than the width and a horizontal (normal) orientation tag.  I suspect it was physically rotated by the the software you used to do the extra compression.  There is no reason for any software not to display this properly.


fcb38

Hello guys, It's me again.

I put pictures on the cloud:
https://www.dropbox.com/sh/ni2s3a09fuzbd38/AABWdzjJMKptSHIN_Fnnm7DQa?dl=0

Original Picture : Original.jpg
Compressed image : Compressed.jpg

I have launched a command "Exiftool.exe - a" on both files. Results are in the cloud.

I think that CAM2PC (my old software) take the File TAGs "ImageWidth" and "ImageHeight" to choose "Orientation".

When I try to change these File Tags with ExifTool Gui :

Warning: Sorry, file:ImageWidth doesn't exist or isn't writable
Warning: Sorry, file:ImageHeight doesn't exist or isn't writable
Nothing to do.
<-END-


As tell phil :

Quote from: Phil Harvey on October 28, 2020, 08:08:49 AM
File:ImageWidth/ImageHeight are properties of the image itself.  ExifTool can not be used to modify the image data.

- Phil

Is there a solution to see my pictures coming from my Samsung A71with a good orientation in my old unsupported tool CAMP2PC without recompressing the file?

Regards.

Alan Clifford

#13
What happened when you followed my suggestion and modified the orientation tag to test the reaction by your software?

If your software is not using the orientation tag, you will need to rotate the picture.  You can do that losslessly with jpegtran. There appears to be a windows version at https://ijg.org/


StarGeek

Quote from: Alan Clifford on November 01, 2020, 06:44:20 AM
If your software is not using the orientation tag, you will need to rotate the picture.  You can do that losslessly with jpegtran. There appears to be a windows version at https://ijg.org/

I would suggest Irfanview with the Jpeg Lossless plugin, which is part of the plugin package.  It is much easier and significantly faster than jpegtran.  Also, it does so in a GUI, which would probably be easier than a command line program for fcb38.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).