diff --git a/components/fpexif/fpeexifdata.pas b/components/fpexif/fpeexifdata.pas index fa919a788..1f3045a5d 100644 --- a/components/fpexif/fpeexifdata.pas +++ b/components/fpexif/fpeexifdata.pas @@ -21,6 +21,7 @@ const TAG_COMPRESSION = $0103; TAG_MAKE = $010F; TAG_MODEL = $0110; + TAG_ORIENTATION = $0112; TAG_THUMBSTARTOFFSET = $0201; TAG_THUMBSIZE = $0202; TAG_EXIFVERSION = $9000; @@ -72,6 +73,7 @@ type function GetTagCount: Integer; procedure SetExportOptions(const AValue: TExportOptions); procedure SetGPSPosition(AKind: Integer; AValue: Double); + procedure SetOrientation(AValue: TExifOrientation); procedure SetTagByID(ATagID: TTagID; ATag: TTag); procedure SetTagByIndex(AIndex: Integer; ATag: TTag); procedure SetTagByName(AFullTagName: String; ATag: TTag); @@ -145,7 +147,7 @@ type property ImgWidth: Integer read GetImgWidth; property ImgOrientation: TExifOrientation - read GetOrientation; + read GetOrientation write SetOrientation; property GPSAltitude: Double index 2 read GetGPSPosition write SetGPSPosition; property GPSLatitude: Double index 1 read GetGPSPosition write SetGPSPosition; property GPSLongitude: Double index 0 read GetGPSPosition write SetGPSPosition; @@ -1210,6 +1212,28 @@ begin end; end; +procedure TExifData.SetOrientation(AValue: TExifOrientation); +var + idx, idx0: Integer; + tag: TTag; + found: Boolean = false; +begin + tag := TagByID[TAGPARENT_EXIF or TAG_ORIENTATION]; + if tag <> nil then + begin + tag.AsInteger := ord(AValue); + found := true; + end; + + tag := TagByID[TAGPARENT_PRIMARY or TAG_ORIENTATION]; + if tag = nil then + begin + if found then exit; + tag := AddTagByID(TAGPARENT_PRIMARY or TAG_ORIENTATION); + end; + tag.AsInteger := ord(AValue); +end; + procedure TExifData.SetTagByID(ATagID: TTagID; ATag: TTag); var idx: Integer;