AW: JPEG drehen anhand des orientation-flag in den EXIF
Hallo zusammen
@Kuni
Wenn du mir ein Hochformatfoto schickst, dann sag ich dir, ob deine Cam das kann. Muss aber direkt aus der cam kommen. FF verfälscht das Flag leider beim Speichern.
@Destroyer
Hier mal der Auszug aus den Exif-Spezifikationen:
Orientation
The image orientation viewed in terms of rows and columns.
Tag = 274 (112.H)
Type = SHORT
Count = 1
Default = 1
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
Other = reserved
Ob sinnvoll oder nicht, hier mein Skript.
Es überprüft alle markierten Bilder und dreht sie bei Bedarf, das Orientation-Flag wird dann natürlich zurückgesetzt.
Code:
'Autor: saruman a-menzel@web.de
'
'Dieses Skript überprüft alle selektierten Fotos auf Hochformat.
'Dazu nutzt es das Orientation-Flag in den Exif-Daten, das viele Kameras schreiben
'Alle Hochformatfotos werden verlustfrei gedreht und anschliessend das
'Orientation-Flag zurückgesetzt, damit das Bild bei einem erneuten Durchlauf nicht nochmal
'gedreht wird.
Dim Datei
Dim DateiCount
Dim Orientation
Dim i
i = 0
'Alle selektierten Fotos durchgehen
DateiCount = ff_GetImageCount
while i < DateiCount
Datei = FF_GetImageName(i)
FF_SetProgressText i, DateiCount-1, Datei
'Wenn die Exif-Daten fehlen, das Bild überspringen
If FF_LoadExif(Datei) Then
If FF_HasExif Then
Orientation = FF_GetExifTag("Orientation")
'Wenn Hochformat oder Kopfüber, dann Exif-Daten zurücksetzen
If Orientation = 3 or Orientation = 6 or Orientation = 8 then
FF_SetExifTag("Orientation"), 1
FF_SaveExif Datei
end if
'Jetzt wird verlustfrei gedreht
If Orientation = "8" Then
FF_RotateFile Datei, 270
ElseIf Orientation = "6" Then
FF_RotateFile Datei, 90
ElseIf Orientation = "3" Then
FF_RotateFile Datei, 180
End If
End If
End If
i=i+1
wend
Grüße
Andreas