Gdiplus [53]: image (5) attributes of images (image metadata)

Source: Internet
Author: User
Related methods and attributes:
Igpimage. getpropertyitem (); {Get attribute item} igpimage. setpropertyitem (); {set attribute item} igpimage. removepropertyitem (); {Delete attribute item} igpimage. propertyidlist; {Get image attribute ID array} igpimage. propertyitems; {retrieving image attribute sets}
 

Igpimage. propertyitems points to an igppropertyitems array;
Igppropertyitem is an attribute (or attribute) in the igppropertyitems attribute array ).

Each attribute item contains:

Igppropertyitem. ID; {property ID, that is, property category, for example, title or copyright} igppropertyitem. valuetype; {attribute data type} igppropertyitem. length; {attribute data length} igppropertyitem. value; {Attribute Data Pointer}
 

Igpimage. propertyidlist is only an array for retrieving attribute IDs.

Igppropertyitem. valuetype constant:

Propertytagtypebyte = 1; {byte array} propertytagtypeascii = 2; {pansichar} bytes = 3; {word} propertytagtypelong = 4; {Cardinal} propertytagtyperational = 5; {Cardinal/Cardinal; the first number is numerator, and the second number is denominator} propertytagtypeundefined = 7; {A byte array that can contain any data type} propertytagtypeslong = 9; {INTEGER} propertytagtypesrational = 10; {INTEGER/Integer; the first number is the numerator, and the second number is the denominator}
 

Igppropertyitem. ID constant:

PropertyTagGpsVer                         = $0000PropertyTagGpsLatitudeRef                 = $0001PropertyTagGpsLatitude                    = $0002PropertyTagGpsLongitudeRef                = $0003PropertyTagGpsLongitude                   = $0004PropertyTagGpsAltitudeRef                 = $0005PropertyTagGpsAltitude                    = $0006PropertyTagGpsGpsTime                     = $0007PropertyTagGpsGpsSatellites               = $0008PropertyTagGpsGpsStatus                   = $0009PropertyTagGpsGpsMeasureMode              = $000APropertyTagGpsGpsDop                      = $000BPropertyTagGpsSpeedRef                    = $000CPropertyTagGpsSpeed                       = $000DPropertyTagGpsTrackRef                    = $000EPropertyTagGpsTrack                       = $000FPropertyTagGpsImgDirRef                   = $0010PropertyTagGpsImgDir                      = $0011PropertyTagGpsMapDatum                    = $0012PropertyTagGpsDestLatRef                  = $0013PropertyTagGpsDestLat                     = $0014PropertyTagGpsDestLongRef                 = $0015PropertyTagGpsDestLong                    = $0016PropertyTagGpsDestBearRef                 = $0017PropertyTagGpsDestBear                    = $0018PropertyTagGpsDestDistRef                 = $0019PropertyTagGpsDestDist                    = $001APropertyTagNewSubfileType                 = $00FEPropertyTagSubfileType                    = $00FFPropertyTagImageWidth                     = $0100PropertyTagImageHeight                    = $0101PropertyTagBitsPerSample                  = $0102PropertyTagCompression                    = $0103PropertyTagPhotometricInterp              = $0106PropertyTagThreshHolding                  = $0107PropertyTagCellWidth                      = $0108PropertyTagCellHeight                     = $0109PropertyTagFillOrder                      = $010APropertyTagDocumentName                   = $010DPropertyTagImageDescription               = $010EPropertyTagEquipMake                      = $010FPropertyTagEquipModel                     = $0110PropertyTagStripOffsets                   = $0111PropertyTagOrientation                    = $0112PropertyTagSamplesPerPixel                = $0115PropertyTagRowsPerStrip                   = $0116PropertyTagStripBytesCount                = $0117PropertyTagMinSampleValue                 = $0118PropertyTagMaxSampleValue                 = $0119PropertyTagXResolution                    = $011APropertyTagYResolution                    = $011BPropertyTagPlanarConfig                   = $011CPropertyTagPageName                       = $011DPropertyTagXPosition                      = $011EPropertyTagYPosition                      = $011FPropertyTagFreeOffset                     = $0120PropertyTagFreeByteCounts                 = $0121PropertyTagGrayResponseUnit               = $0122PropertyTagGrayResponseCurve              = $0123PropertyTagT4Option                       = $0124PropertyTagT6Option                       = $0125PropertyTagResolutionUnit                 = $0128PropertyTagPageNumber                     = $0129PropertyTagTransferFunction               = $012DPropertyTagSoftwareUsed                   = $0131PropertyTagDateTime                       = $0132PropertyTagArtist                         = $013BPropertyTagHostComputer                   = $013CPropertyTagPredictor                      = $013DPropertyTagWhitePoint                     = $013EPropertyTagPrimaryChromaticities          = $013FPropertyTagColorMap                       = $0140PropertyTagHalftoneHints                  = $0141PropertyTagTileWidth                      = $0142PropertyTagTileLength                     = $0143PropertyTagTileOffset                     = $0144PropertyTagTileByteCounts                 = $0145PropertyTagInkSet                         = $014CPropertyTagInkNames                       = $014DPropertyTagNumberOfInks                   = $014EPropertyTagDotRange                       = $0150PropertyTagTargetPrinter                  = $0151PropertyTagExtraSamples                   = $0152PropertyTagSampleFormat                   = $0153PropertyTagSMinSampleValue                = $0154PropertyTagSMaxSampleValue                = $0155PropertyTagTransferRange                  = $0156PropertyTagJPEGProc                       = $0200PropertyTagJPEGInterFormat                = $0201PropertyTagJPEGInterLength                = $0202PropertyTagJPEGRestartInterval            = $0203PropertyTagJPEGLosslessPredictors         = $0205PropertyTagJPEGPointTransforms            = $0206PropertyTagJPEGQTables                    = $0207PropertyTagJPEGDCTables                   = $0208PropertyTagJPEGACTables                   = $0209PropertyTagYCbCrCoefficients              = $0211PropertyTagYCbCrSubsampling               = $0212PropertyTagYCbCrPositioning               = $0213PropertyTagREFBlackWhite                  = $0214PropertyTagGamma                          = $0301PropertyTagICCProfileDescriptor           = $0302PropertyTagSRGBRenderingIntent            = $0303PropertyTagImageTitle                     = $0320PropertyTagResolutionXUnit                = $5001PropertyTagResolutionYUnit                = $5002PropertyTagResolutionXLengthUnit          = $5003PropertyTagResolutionYLengthUnit          = $5004PropertyTagPrintFlags                     = $5005PropertyTagPrintFlagsVersion              = $5006PropertyTagPrintFlagsCrop                 = $5007PropertyTagPrintFlagsBleedWidth           = $5008PropertyTagPrintFlagsBleedWidthScale      = $5009PropertyTagHalftoneLPI                    = $500APropertyTagHalftoneLPIUnit                = $500BPropertyTagHalftoneDegree                 = $500CPropertyTagHalftoneShape                  = $500DPropertyTagHalftoneMisc                   = $500EPropertyTagHalftoneScreen                 = $500FPropertyTagJPEGQuality                    = $5010PropertyTagGridSize                       = $5011PropertyTagThumbnailFormat                = $5012PropertyTagThumbnailWidth                 = $5013PropertyTagThumbnailHeight                = $5014PropertyTagThumbnailColorDepth            = $5015PropertyTagThumbnailPlanes                = $5016PropertyTagThumbnailRawBytes              = $5017PropertyTagThumbnailSize                  = $5018PropertyTagThumbnailCompressedSize        = $5019PropertyTagColorTransferFunction          = $501APropertyTagThumbnailData                  = $501BPropertyTagThumbnailImageWidth            = $5020PropertyTagThumbnailImageHeight           = $5021PropertyTagThumbnailBitsPerSample         = $5022PropertyTagThumbnailCompression           = $5023PropertyTagThumbnailPhotometricInterp     = $5024PropertyTagThumbnailImageDescription      = $5025PropertyTagThumbnailEquipMake             = $5026PropertyTagThumbnailEquipModel            = $5027PropertyTagThumbnailStripOffsets          = $5028PropertyTagThumbnailOrientation           = $5029PropertyTagThumbnailSamplesPerPixel       = $502APropertyTagThumbnailRowsPerStrip          = $502BPropertyTagThumbnailStripBytesCount       = $502CPropertyTagThumbnailResolutionX           = $502DPropertyTagThumbnailResolutionY           = $502EPropertyTagThumbnailPlanarConfig          = $502FPropertyTagThumbnailResolutionUnit        = $5030PropertyTagThumbnailTransferFunction      = $5031PropertyTagThumbnailSoftwareUsed          = $5032PropertyTagThumbnailDateTime              = $5033PropertyTagThumbnailArtist                = $5034PropertyTagThumbnailWhitePoint            = $5035PropertyTagThumbnailPrimaryChromaticities = $5036PropertyTagThumbnailYCbCrCoefficients     = $5037PropertyTagThumbnailYCbCrSubsampling      = $5038PropertyTagThumbnailYCbCrPositioning      = $5039PropertyTagThumbnailRefBlackWhite         = $503APropertyTagThumbnailCopyRight             = $503BPropertyTagLuminanceTable                 = $5090PropertyTagChrominanceTable               = $5091PropertyTagFrameDelay                     = $5100PropertyTagLoopCount                      = $5101PropertyTagGlobalPalette                  = $5102PropertyTagIndexBackground                = $5103PropertyTagIndexTransparent               = $5104PropertyTagPixelUnit                      = $5110PropertyTagPixelPerUnitX                  = $5111PropertyTagPixelPerUnitY                  = $5112PropertyTagPaletteHistogram               = $5113PropertyTagCopyright                      = $8298PropertyTagExifExposureTime               = $829APropertyTagExifFNumber                    = $829DPropertyTagExifIFD                        = $8769PropertyTagICCProfile                     = $8773PropertyTagExifExposureProg               = $8822PropertyTagExifSpectralSense              = $8824PropertyTagGpsIFD                         = $8825PropertyTagExifISOSpeed                   = $8827PropertyTagExifOECF                       = $8828PropertyTagExifVer                        = $9000PropertyTagExifDTOrig                     = $9003PropertyTagExifDTDigitized                = $9004PropertyTagExifCompConfig                 = $9101PropertyTagExifCompBPP                    = $9102PropertyTagExifShutterSpeed               = $9201PropertyTagExifAperture                   = $9202PropertyTagExifBrightness                 = $9203PropertyTagExifExposureBias               = $9204PropertyTagExifMaxAperture                = $9205PropertyTagExifSubjectDist                = $9206PropertyTagExifMeteringMode               = $9207PropertyTagExifLightSource                = $9208PropertyTagExifFlash                      = $9209PropertyTagExifFocalLength                = $920APropertyTagExifMakerNote                  = $927CPropertyTagExifUserComment                = $9286PropertyTagExifDTSubsec                   = $9290PropertyTagExifDTOrigSS                   = $9291PropertyTagExifDTDigSS                    = $9292PropertyTagExifFPXVer                     = $A000PropertyTagExifColorSpace                 = $A001PropertyTagExifPixXDim                    = $A002PropertyTagExifPixYDim                    = $A003PropertyTagExifRelatedWav                 = $A004PropertyTagExifInterop                    = $A005PropertyTagExifFlashEnergy                = $A20BPropertyTagExifSpatialFR                  = $A20CPropertyTagExifFocalXRes                  = $A20EPropertyTagExifFocalYRes                  = $A20FPropertyTagExifFocalResUnit               = $A210PropertyTagExifSubjectLoc                 = $A214PropertyTagExifExposureIndex              = $A215PropertyTagExifSensingMethod              = $A217PropertyTagExifFileSource                 = $A300PropertyTagExifSceneType                  = $A301PropertyTagExifCfaPattern                 = $A302
 

Traversal property:

uses GdiPlus;procedure TForm1.Button1Click(Sender: TObject);var  Image: IGPImage;  PropertyItem: IGPPropertyItem;begin  Image := TGPImage.Create('C:\GdiPlusImg\FakePhoto.jpg');  Memo1.Clear;  for PropertyItem in Image.PropertyItems do with Memo1.Lines do  begin    Add(Format('Id: $%.4x', [PropertyItem.Id]));    Add(Format('ValueType: %d', [PropertyItem.ValueType]));    Add(Format('Length: %d', [PropertyItem.Length]));    Add(Format('Value: $%p', [PropertyItem.Value]));    Add(EmptyStr);  end;end;
 

Traverse only the property ID:

uses GdiPlus;procedure TForm1.Button1Click(Sender: TObject);var  Image: IGPImage;  PropID: Cardinal;begin  Image := TGPImage.Create('C:\GdiPlusImg\FakePhoto.jpg');  Memo1.Clear;  for PropID in Image.PropertyIdList do  begin    Memo1.Lines.Add(Format('$%.4x', [PropID]));  end;end;
 

The following example tests the setpropertyitem, getpropertyitem, and removepropertyitem methods.

The title attribute (whose ID is propertytagimagetitle) is added to the image first );
Save the image, open it again, and then read this attribute;
After deleting this property, I tried to find it...

Uses gdiplus; Procedure construct (Sender: tobject); var image: igpimage; proptitle: igppropertyitem; Title: ansistring; I: integer; begin chdir ('C: \ gdiplusimg \'); image: = tgpimage.create('fakephoto.jpg '); // Title: = 'new title'; proptitle: = tgppropertyitem. create; proptitle. ID: = propertytagimagetitle; proptitle. valuetype: = propertytagtypeascii; proptitle. length: = length (title) + 1; proptitle. value: = pansichar (title); image. setpropertyitem (proptitle); image.save('fakephoto_test.jpg ', tgpimageformat. JPEG); Image: = nil; // proptitle: = nil; Image: = tgpimage.create('fakephoto_test.jpg '); proptitle: = image. getpropertyitem (propertytagimagetitle); showmessage (pansichar (proptitle. value); {New title} // image. removepropertyitem (propertytagimagetitle); for I: = 0 to image. propertyidlist. count-1 do if image. propertyidlist [I] = propertytagimagetitle then showmessage ('Property title detected exist'); {No more deleted} end;
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.