473,216 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,216 software developers and data experts.

How do I update EXIF Metadata?

22 16bit
I am looking for an example of a program, routine, or code snippet, that will show me exactly how to update a picture's exit metadata. I have been successful in READING this information (using the ExifWorks class).


Thanks in advance!
Jan 6 '17 #1
4 27691
Frinavale
9,735 Expert Mod 8TB
I looked into this for you and I can't believe how messy it is.

The way I figured out how to do this was to open an image (using the Image class), access the metadata on the file (represented through PropertyItem classes), edit the information and save it as a new image.

Sounds simple but there is a lot to understand before this can be done.

First of all the PropertyInfo class does contain metadata information BUT the information it gives you is pretty useless on its own without doing some research into it.

The PropertyInfoclass has the following properties:
  • ID: Gets or sets the ID of the property and indicates what the metadata is (this is an integer value that is unintelligible without looking up what it represents)
  • Value: Gets or sets the value of the metadata (byte data which is unreadable and unusable until converted)
  • Type: Gets or sets an integer that defines the type of data contained in the Value property (since this is an integer, it is unintelligible without looking up what the integer represents)
  • Len: Gets or sets the length (in bytes) of the Value property.

The first problem I found was that the ID property, which represents what the metadata is, is stored as a decimal-based integer value in the object; however, the documentation (found here and in other locations on the web) lists them in HEX!

So what I did was copy the documentation into code as a HashTable, edit a .jpeg file and provide as much metadata as I could, loop through the PropertyItems for the image and for every known hex value I wrote it's corresponding Decimal value into a text document to generate an Enum that I could use in my code to do stuff.

After setting as much metadata as I could through Windows Explorer I saw many hex ID values for metadata that I had no way of matching to meaningful data because the value is a byte and the type could not be converted to see what the values were (for example if the metadata had dates in it...those dates were made available as "bytes" or "byte arrays" but I had no idea which metadata had date values because type ID is "byte" or something I couldn't convert. If I had more time I would set each field one by one and see what the corresponding ID is and then "know" that it has a Date type in it...but this is just TOO much work for an example)

The second problem is that the Value property is an array of bytes that you have to convert into an appropriate, corresponding type in your code so that you can actually see what that value is. You can find a table with the integer "Type" values matched with the corresponding data types in this article. And when you go to set the metadata information you need to convert it into a Byte array also.

Lastly, the classes are designed by Microsoft in such a way that lets you edit existing metadata already part of the file; however it was not designed to let you create a new piece of metadata because the PropertyInfo class does not have a public constructor!!! I found a way around this using Reflection though, so my example demonstrates how to add a new piece of meta data (your welcome)

That is pretty much the background (check out the links I have posed throughout my response for more information on everything).

Here is my code example!

Prerequisites:
  • I made sure that I had a .jpg file called ImageFile.jpg in my "My Pictures" folder. This image does not contain preset metadata for the "Title" metadata.
  • I used visual studio to create a Console type application.
  • This is my code within the Module1.vb file within my console application.

Expand|Select|Wrap|Line Numbers
  1. Imports System.Drawing.Imaging
  2. Imports System.Drawing
  3. Imports System.Text
  4.  
  5. Module Module1
  6.  Public Enum DecIDValues
  7.         Title = 270 'Also Subject
  8.         CameraMaker = 271
  9.         CameraModel = 272
  10.         Authors = 315
  11.         Copyright = 33432
  12.         ExifExposureProg = 34850
  13.         ExifISOSpeed = 34855
  14.         ExifDTOrig = 36867
  15.         ExifDTDigitized = 36868
  16.         ExifMeteringMode = 37383
  17.         ExifLightSource = 37384
  18.         ExifFlash = 37385
  19.         ExifDTOrigSS = 37521
  20.         ExifDTDigSS = 37522
  21.         ThumbnailCompression = 20515
  22.         ThumbnailResolutionUnit = 20528
  23.         ExifUserComment = 37510
  24.         ChrominanceTable = 20625
  25.         LuminanceTable = 20624
  26.     End Enum
  27.  
  28.     Private typeValuesTable As New Hashtable
  29.     Private idValuesTable As New Hashtable
  30.     Private ascii As Encoding = Encoding.ASCII
  31.  
  32.     Sub Main()
  33.         SetUpHashTables()
  34.         SetMetaData()
  35.         DisplayImageMetaData()
  36.         Console.ReadLine()
  37.     End Sub
  38.  
  39.     Private Sub SetMetaData()
  40.         'you need to change the path to the file you are going to edit
  41.         Dim newImage As Bitmap = New Bitmap("C:\Users\Frinavale\Pictures\Saved\ImageFile.jpg")
  42.  
  43.          'newItem is constructed as a PropertyItem class that will be used to set the Title metadata for the image fiel
  44.         Dim newItem = DirectCast(Runtime.Serialization.FormatterServices.GetUninitializedObject(GetType(PropertyItem)), PropertyItem)
  45.         newItem.Id = DecIDValues.Title 'See the Enum value
  46.         newItem.Value = Encoding.ASCII.GetBytes("Title set from Module 1")' Using the ASCII encoder to set the metadata to a byte array with the string data we want
  47.         newItem.Len = newItem.Len 'Making sure the length is set because otherwise it won't show up in the metadata when viewing it later
  48.         newItem.Type = 2 'Setting the type to indicate it is ASCII
  49.         newImage.SetPropertyItem(newItem) 'Using the SetPropertyItem method to set the metadata information
  50.  
  51.         'The following commented out code will loop through all of the 
  52.         'Existing meta data and if it is an ASCII type it changes it
  53.         'It is to demonstrate how to "edit" an existing value rather than add a new one
  54.  
  55.         'For Each piNewImage In newImage.PropertyItems
  56.         '    If piNewImage.Type = 2 Then
  57.         '        piNewImage.Value = Encoding.ASCII.GetBytes("Changed by module1")
  58.         '        newImage.RemovePropertyItem(piNewImage.Id)
  59.         '        newImage.SetPropertyItem(piNewImage)
  60.         '    End If
  61.         'Next
  62.  
  63.  
  64.         newImage.Save("C:\Users\Frinavale\Pictures\Saved\ImageFile2.jpg")
  65.         newImage.Dispose()
  66.  
  67.         'At this point you can consider deleting the original
  68.  
  69.     End Sub
  70.     Private Sub DisplayImageMetaData()
  71.         'Opening the image
  72.         Dim theImage As Bitmap = New Bitmap("C:\Users\Frinavale\Pictures\Saved\ImageFile2.jpg") 
  73.         'Grabbing the metadata
  74.         Dim propItems As PropertyItem() = theImage.PropertyItems
  75.  
  76.         'Looping through each piece of metadata and displaying its information (if possible)
  77.         For Each pi In propItems
  78.             Dim id = String.Format("0x{0}", pi.Id.ToString("x")) 'Retrieving the name of the metadata (if it is known) from the hashtable with the IDs and names
  79.             Console.WriteLine("ID: {0}", If(idValuesTable(id) Is Nothing, id, idValuesTable(id))) ' Displaying the name of the metadata, or it's HEX value
  80.             Console.WriteLine("Dec ID: {0}", pi.Id.ToString) 'Displaying the Decimal value for the ID
  81.             Dim type As String = pi.Type.ToString 
  82.             Console.WriteLine("Len: {0}", pi.Len.ToString)
  83.             Console.WriteLine("Type: {0}", If(typeValuesTable(type) Is Nothing, type, typeValuesTable(type))) 'Displaying the "type" of metadata 
  84.             Console.Write("Value: ")
  85.  
  86.            'The following attempts to display the value set for the metadata
  87.            'If there is no corresponding type in VB.NET, or if it is impossible to display...it just writes the type it is supposed to be.
  88.             Select Case pi.Type
  89.                 Case 1 'byte
  90.                     Console.Write("...byte...")
  91.                 Case 2 'array of byte objects encoded as ASCII
  92.  
  93.                     Dim asciiChars(ascii.GetCharCount(pi.Value, 0, pi.Value.Length) - 1) As Char
  94.                     ascii.GetChars(pi.Value, 0, pi.Value.Length, asciiChars, 0)
  95.                     Dim asciiString As New String(asciiChars)
  96.                     Console.Write(asciiString)
  97.                 Case 3 ' 16 bit int
  98.                     Dim i As Int16 = BitConverter.ToInt16(pi.Value, 0)
  99.                     Console.Write(i.ToString)
  100.                 Case 4 ' 32 bit int
  101.                     Dim i As Int32 = BitConverter.ToInt32(pi.Value, 0)
  102.                     Console.Write(i.ToString)
  103.                 Case 5 ' array of 2 byte objects: rational number
  104.                     Console.Write("...A Rational number (from 2 bytes)...")
  105.                 Case 6 ' Not used
  106.                     Console.Write("...not used...")
  107.                 Case 7 ' undefined
  108.                     Console.Write("...undefined...")
  109.                 Case 8 'Not used
  110.                     Console.Write("...not used...")
  111.                 Case 9 'SLong
  112.                     Dim i As Long = BitConverter.ToDouble(pi.Value, 0)
  113.                     Console.Write(i.ToString)
  114.                 Case 10 'SRational
  115.                     Console.Write("...SRational number...")
  116.             End Select
  117.             Console.WriteLine()
  118.             Console.WriteLine()
  119.         Next
  120.  
  121.         theImage.Dispose()
  122.     End Sub
  123.  
  124.     Private Sub SetUpHashTables()
  125.         typeValuesTable.Clear()
  126.         typeValuesTable.Add("1", "A Byte")
  127.         typeValuesTable.Add("2", "An array of Byte objects encoded as ASCII")
  128.         typeValuesTable.Add("3", "A 16-bit integer")
  129.         typeValuesTable.Add("4", "A 32-bit integer")
  130.         typeValuesTable.Add("5", "An array of two Byte objects that represent a rational number")
  131.         typeValuesTable.Add("6", "Not used")
  132.         typeValuesTable.Add("7", "Undefined")
  133.         typeValuesTable.Add("8", "Not used")
  134.         typeValuesTable.Add("9", "SLong")
  135.         typeValuesTable.Add("10", "SRational")
  136.  
  137.  
  138.         idValuesTable.Clear()
  139.         idValuesTable.Add("x0000", "GpsVer")
  140.         idValuesTable.Add("0x0001", "GpsLatitudeRef")
  141.         idValuesTable.Add("0x0002", "GpsLatitude")
  142.         idValuesTable.Add("0x0003", "GpsLongitudeRef")
  143.         idValuesTable.Add("0x0004", "GpsLongitude")
  144.         idValuesTable.Add("0x0005", "GpsAltitudeRef")
  145.         idValuesTable.Add("0x0006", "GpsAltitude")
  146.         idValuesTable.Add("0x0007", "GpsGpsTime")
  147.         idValuesTable.Add("0x0008", "GpsGpsSatellites")
  148.         idValuesTable.Add("0x0009", "GpsGpsStatus")
  149.         idValuesTable.Add("0x000A", "GpsGpsMeasureMode")
  150.         idValuesTable.Add("0x000B", "GpsGpsDop")
  151.         idValuesTable.Add("0x000C", "GpsSpeedRef")
  152.         idValuesTable.Add("0x000D", "GpsSpeed")
  153.         idValuesTable.Add("0x000E", "GpsTrackRef")
  154.         idValuesTable.Add("0x000F", "GpsTrack")
  155.         idValuesTable.Add("0x0010", "GpsImgDirRef")
  156.         idValuesTable.Add("0x0011", "GpsImgDir")
  157.         idValuesTable.Add("0x0012", "GpsMapDatum")
  158.         idValuesTable.Add("0x0013", "GpsDestLatRef")
  159.         idValuesTable.Add("0x0014", "GpsDestLat")
  160.         idValuesTable.Add("0x0015", "GpsDestLongRef")
  161.         idValuesTable.Add("0x0016", "GpsDestLong")
  162.         idValuesTable.Add("0x0017", "GpsDestBearRef")
  163.         idValuesTable.Add("0x0018", "GpsDestBear")
  164.         idValuesTable.Add("0x0019", "GpsDestDistRef")
  165.         idValuesTable.Add("0x001A", "GpsDestDist")
  166.         idValuesTable.Add("0x00FE", "NewSubfileType")
  167.         idValuesTable.Add("0x00FF", "SubfileType")
  168.         idValuesTable.Add("0x0100", "ImageWidth")
  169.         idValuesTable.Add("0x0101", "ImageHeight")
  170.         idValuesTable.Add("0x0102", "BitsPerSample")
  171.         idValuesTable.Add("0x0103", "Compression")
  172.         idValuesTable.Add("0x0106", "PhotometricInterp")
  173.         idValuesTable.Add("0x0107", "ThreshHolding")
  174.         idValuesTable.Add("0x0108", "CellWidth")
  175.         idValuesTable.Add("0x0109", "CellHeight")
  176.         idValuesTable.Add("0x010A", "FillOrder")
  177.         idValuesTable.Add("0x010D", "DocumentName")
  178.         idValuesTable.Add("0x010E", "ImageDescription")
  179.         idValuesTable.Add("0x010F", "EquipMake")
  180.         idValuesTable.Add("0x0110", "EquipModel")
  181.         idValuesTable.Add("0x0111", "StripOffsets")
  182.         idValuesTable.Add("0x0112", "Orientation")
  183.         idValuesTable.Add("0x0115", "SamplesPerPixel")
  184.         idValuesTable.Add("0x0116", "RowsPerStrip")
  185.         idValuesTable.Add("0x0117", "StripBytesCount")
  186.         idValuesTable.Add("0x0118", "MinSampleValue")
  187.         idValuesTable.Add("0x0119", "MaSampleValue")
  188.         idValuesTable.Add("0x011A", "Resolution")
  189.         idValuesTable.Add("0x011B", "YResolution")
  190.         idValuesTable.Add("0x011C", "PlanarConfig")
  191.         idValuesTable.Add("0x011D", "PageName")
  192.         idValuesTable.Add("0x011E", "XPosition")
  193.         idValuesTable.Add("0x011F", "YPosition")
  194.         idValuesTable.Add("0x0120", "FreeOffset")
  195.         idValuesTable.Add("0x0121", "FreeByteCounts")
  196.         idValuesTable.Add("0x0122", "GrayResponseUnit")
  197.         idValuesTable.Add("0x0123", "GrayResponseCurve")
  198.         idValuesTable.Add("0x0124", "T4Option")
  199.         idValuesTable.Add("0x0125", "T6Option")
  200.         idValuesTable.Add("0x0128", "ResolutionUnit")
  201.         idValuesTable.Add("0x0129", "PageNumber")
  202.         idValuesTable.Add("0x012D", "TransferFunction")
  203.         idValuesTable.Add("0x0131", "SoftwareUsed")
  204.         idValuesTable.Add("0x0132", "DateTime")
  205.         idValuesTable.Add("0x013B", "Artist")
  206.         idValuesTable.Add("0x013C", "HostComputer")
  207.         idValuesTable.Add("0x013D", "Predictor")
  208.         idValuesTable.Add("0x013E", "WhitePoint")
  209.         idValuesTable.Add("0x013F", "PrimaryChromaticities")
  210.         idValuesTable.Add("0x0140", "ColorMap")
  211.         idValuesTable.Add("0x0141", "HalftoneHints")
  212.         idValuesTable.Add("0x0142", "TileWidth")
  213.         idValuesTable.Add("0x0143", "TileLength")
  214.         idValuesTable.Add("0x0144", "TileOffset")
  215.         idValuesTable.Add("0x0145", "TileByteCounts")
  216.         idValuesTable.Add("0x014C", "InkSet")
  217.         idValuesTable.Add("0x014D", "InkNames")
  218.         idValuesTable.Add("0x014E", "NumberOfInks")
  219.         idValuesTable.Add("0x0150", "DotRange")
  220.         idValuesTable.Add("0x0151", "TargetPrinter")
  221.         idValuesTable.Add("0x0152", "ExtraSamples")
  222.         idValuesTable.Add("0x0153", "SampleFormat")
  223.         idValuesTable.Add("0x0154", "SMinSampleValue")
  224.         idValuesTable.Add("0x0155", "SMaxSampleValue")
  225.         idValuesTable.Add("0x0156", "TransferRange")
  226.         idValuesTable.Add("0x0200", "JPEGProc")
  227.         idValuesTable.Add("0x0201", "JPEGInterFormat")
  228.         idValuesTable.Add("0x0202", "JPEGInterLength")
  229.         idValuesTable.Add("0x0203", "JPEGRestartInterval")
  230.         idValuesTable.Add("0x0205", "JPEGLosslessPredictors")
  231.         idValuesTable.Add("0x0206", "JPEGPointTransforms")
  232.         idValuesTable.Add("0x0207", "JPEGQTables")
  233.         idValuesTable.Add("0x0208", "JPEGDCTables")
  234.         idValuesTable.Add("0x0209", "JPEGACTables")
  235.         idValuesTable.Add("0x0211", "YCbCrCoefficients")
  236.         idValuesTable.Add("0x0212", "YCbCrSubsampling")
  237.         idValuesTable.Add("0x0213", "YCbCrPositioning")
  238.         idValuesTable.Add("0x0214", "REFBlackWhite")
  239.         idValuesTable.Add("0x0301", "Gamma")
  240.         idValuesTable.Add("0x0302", "ICCProfileDescriptor")
  241.         idValuesTable.Add("0x0303", "SRGBRenderingIntent")
  242.         idValuesTable.Add("0x0320", "ImageTitle")
  243.         idValuesTable.Add("0x5001", "ResolutionXUnit")
  244.         idValuesTable.Add("0x5002", "ResolutionYUnit")
  245.         idValuesTable.Add("0x5003", "ResolutionXLengthUnit")
  246.         idValuesTable.Add("0x5004", "ResolutionYLengthUnit")
  247.         idValuesTable.Add("0x5005", "PrintFlags")
  248.         idValuesTable.Add("0x5006", "PrintFlagsVersion")
  249.         idValuesTable.Add("0x5007", "PrintFlagsCrop")
  250.         idValuesTable.Add("0x5008", "PrintFlagsBleedWidth")
  251.         idValuesTable.Add("0x5009", "PrintFlagsBleedWidthScale")
  252.         idValuesTable.Add("0x500A", "HalftoneLPI")
  253.         idValuesTable.Add("0x500B", "HalftoneLPIUnit")
  254.         idValuesTable.Add("0x500C", "HalftoneDegree")
  255.         idValuesTable.Add("0x500D", "HalftoneShape")
  256.         idValuesTable.Add("0x500E", "HalftoneMisc")
  257.         idValuesTable.Add("0x500F", "HalftoneScreen")
  258.         idValuesTable.Add("0x5010", "JPEGQuality")
  259.         idValuesTable.Add("0x5011", "GridSize")
  260.         idValuesTable.Add("0x5012", "ThumbnailFormat")
  261.         idValuesTable.Add("0x5013", "ThumbnailWidth")
  262.         idValuesTable.Add("0x5014", "ThumbnailHeight")
  263.         idValuesTable.Add("0x5015", "ThumbnailColorDepth")
  264.         idValuesTable.Add("0x5016", "ThumbnailPlanes")
  265.         idValuesTable.Add("0x5017", "ThumbnailRawBytes")
  266.         idValuesTable.Add("0x5018", "ThumbnailSize")
  267.         idValuesTable.Add("0x5019", "ThumbnailCompressedSize")
  268.         idValuesTable.Add("0x501A", "ColorTransferFunction")
  269.         idValuesTable.Add("0x501B", "ThumbnailData")
  270.         idValuesTable.Add("0x5020", "ThumbnailImageWidth")
  271.         idValuesTable.Add("0x5021", "ThumbnailImageHeight")
  272.         idValuesTable.Add("0x5022", "ThumbnailBitsPerSample")
  273.         idValuesTable.Add("0x5023", "ThumbnailCompression")
  274.         idValuesTable.Add("0x5024", "ThumbnailPhotometricInterp")
  275.         idValuesTable.Add("0x5025", "ThumbnailImageDescription")
  276.         idValuesTable.Add("0x5026", "ThumbnailEquipMake")
  277.         idValuesTable.Add("0x5027", "ThumbnailEquipModel")
  278.         idValuesTable.Add("0x5028", "ThumbnailStripOffsets")
  279.         idValuesTable.Add("0x5029", "ThumbnailOrientation")
  280.         idValuesTable.Add("0x502A", "ThumbnailSamplesPerPixel")
  281.         idValuesTable.Add("0x502B", "ThumbnailRowsPerStrip")
  282.         idValuesTable.Add("0x502C", "ThumbnailStripBytesCount")
  283.         idValuesTable.Add("0x502D", "ThumbnailResolutionX")
  284.         idValuesTable.Add("0x502E", "ThumbnailResolutionY")
  285.         idValuesTable.Add("0x502F", "ThumbnailPlanarConfig")
  286.         idValuesTable.Add("0x5030", "ThumbnailResolutionUnit")
  287.         idValuesTable.Add("0x5031", "ThumbnailTransferFunction")
  288.         idValuesTable.Add("0x5032", "ThumbnailSoftwareUsed")
  289.         idValuesTable.Add("0x5033", "ThumbnailDateTime")
  290.         idValuesTable.Add("0x5034", "ThumbnailArtist")
  291.         idValuesTable.Add("0x5035", "ThumbnailWhitePoint")
  292.         idValuesTable.Add("0x5036", "ThumbnailPrimaryChromaticities")
  293.         idValuesTable.Add("0x5037", "ThumbnailYCbCrCoefficients")
  294.         idValuesTable.Add("0x5038", "ThumbnailYCbCrSubsampling")
  295.         idValuesTable.Add("0x5039", "ThumbnailYCbCrPositioning")
  296.         idValuesTable.Add("0x503A", "ThumbnailRefBlackWhite")
  297.         idValuesTable.Add("0x503B", "ThumbnailCopyRight")
  298.         idValuesTable.Add("0x5090", "LuminanceTable")
  299.         idValuesTable.Add("0x5091", "ChrominanceTable")
  300.         idValuesTable.Add("0x5100", "FrameDelay")
  301.         idValuesTable.Add("0x5101", "LoopCount")
  302.         idValuesTable.Add("0x5102", "GlobalPalette")
  303.         idValuesTable.Add("0x5103", "IndexBackground")
  304.         idValuesTable.Add("0x5104", "IndexTransparent")
  305.         idValuesTable.Add("0x5110", "PixelUnit")
  306.         idValuesTable.Add("0x5111", "PixelPerUnitX")
  307.         idValuesTable.Add("0x5112", "PixelPerUnitY")
  308.         idValuesTable.Add("0x5113", "PaletteHistogram")
  309.         idValuesTable.Add("0x8298", "Copyright")
  310.         idValuesTable.Add("0x829A", "ExifExposureTime")
  311.         idValuesTable.Add("0x829D", "ExifFNumber")
  312.         idValuesTable.Add("0x8769", "ExifIFD")
  313.         idValuesTable.Add("0x8773", "ICCProfile")
  314.         idValuesTable.Add("0x8822", "ExifExposureProg")
  315.         idValuesTable.Add("0x8824", "ExifSpectralSense")
  316.         idValuesTable.Add("0x8825", "GpsIFD")
  317.         idValuesTable.Add("0x8827", "ExifISOSpeed")
  318.         idValuesTable.Add("0x8828", "ExifOECF")
  319.         idValuesTable.Add("0x9000", "ExifVer")
  320.         idValuesTable.Add("0x9003", "ExifDTOrig")
  321.         idValuesTable.Add("0x9004", "ExifDTDigitized")
  322.         idValuesTable.Add("0x9101", "ExifCompConfig")
  323.         idValuesTable.Add("0x9102", "ExifCompBPP")
  324.         idValuesTable.Add("0x9201", "ExifShutterSpeed")
  325.         idValuesTable.Add("0x9202", "ExifAperture")
  326.         idValuesTable.Add("0x9203", "ExifBrightness")
  327.         idValuesTable.Add("0x9204", "ExifExposureBias")
  328.         idValuesTable.Add("0x9205", "ExifMaxAperture")
  329.         idValuesTable.Add("0x9206", "ExifSubjectDist")
  330.         idValuesTable.Add("0x9207", "ExifMeteringMode")
  331.         idValuesTable.Add("0x9208", "ExifLightSource")
  332.         idValuesTable.Add("0x9209", "ExifFlash")
  333.         idValuesTable.Add("0x920A", "ExifFocalLength")
  334.         idValuesTable.Add("0x927C", "ExifMakerNote")
  335.         idValuesTable.Add("0x9286", "ExifUserComment")
  336.         idValuesTable.Add("0x9290", "ExifDTSubsec")
  337.         idValuesTable.Add("0x9291", "ExifDTOrigSS")
  338.         idValuesTable.Add("0x9292", "ExifDTDigSS")
  339.         idValuesTable.Add("0xA000", "ExifFPXVer")
  340.         idValuesTable.Add("0xA001", "ExifColorSpace")
  341.         idValuesTable.Add("0xA002", "ExifPixXDim")
  342.         idValuesTable.Add("0xA003", "ExifPixYDim")
  343.         idValuesTable.Add("0xA004", "ExifRelatedWav")
  344.         idValuesTable.Add("0xA005", "ExifInterop")
  345.         idValuesTable.Add("0xA20B", "ExifFlashEnergy")
  346.         idValuesTable.Add("0xA20C", "ExifSpatialFR")
  347.         idValuesTable.Add("0xA20E", "ExifFocalXRes")
  348.         idValuesTable.Add("0xA20F", "ExifFocalYRes")
  349.         idValuesTable.Add("0xA210", "ExifFocalResUnit")
  350.         idValuesTable.Add("0xA214", "ExifSubjectLoc")
  351.         idValuesTable.Add("0xA215", "ExifExposureIndex")
  352.         idValuesTable.Add("0xA217", "ExifSensingMethod")
  353.         idValuesTable.Add("0xA300", "ExifFileSource")
  354.         idValuesTable.Add("0xA301", "ExifSceneType")
  355.         idValuesTable.Add("0xA302", "ExifCfaPattern")
  356.  
  357.  
  358.         idValuesTable.Add("0x10e", "Title")
  359.         idValuesTable.Add("0x10f", "CameraMaker")
  360.         idValuesTable.Add("0x110", "CameraModel")
  361.         idValuesTable.Add("0x13b", "Authors")
  362.  
  363.     End Sub
  364.  
  365. End Module
Jan 11 '17 #2
DGrund
22 16bit
Wow! Thank you so much for all of your time and effort. I will grab this code and apply it, and see if I can get a finished product. I will be happy to share it with you once I am done.
Jan 11 '17 #3
Frinavale
9,735 Expert Mod 8TB
Oh yeah, I forgot to mention that not all metadata tags are available for all image types. Make sure the metadata that you are trying to set can actually be set for the image type you are working with (tiff, png, jpg, etc.)


Let me know if you have a problem and I'll try to help.

I'd be interested if you find a better solution too...

I mean, this seems unnecessarily complication, convoluted and cryptic. Why is it so hard? Seriously it's metadata!
Jan 11 '17 #4
Upsilon648
1 Bit
Thank you @frinavale. This code is working for me. I did have to use the .NET Frameworks, as the BITMAP class is not found in the .NET core.
Dec 29 '23 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Useko Netsumi | last post by:
Does anyone aware of any program/apps/scripts that has the ability to modify/add/create/delete metadata in any image type such as JPEG, GIF, PNG, etc. Question for the experts, is it wise to...
2
by: Ivan Herman | last post by:
A question on using the PIL library. If I take a jpg file then, say, resize it and save it somewhere else, all metadata that is part of the jpg file is lost. This is a pity: digital cameras...
1
by: Carl | last post by:
Be careful when implementing views (from SQL Server 97/2K). SQL Server stores the metadata on the view at creation (or the last time it was saved). This means if you have: SELECT * FROM table1 it...
0
by: Erik Naasner | last post by:
hello, what i would like to do is "stamping" my images. after uploading the images from the digital camera it would be usefull to fill out the following exif tags: - Title - Subject -...
1
by: David Shorthouse | last post by:
Hey folks, I have a jog file upload routine & I'd like to also edit the meta data associated with the uploaded file. I'm not too interested in the exif metadata, but the simple file system...
14
by: Frank | last post by:
I see that ImageFormat includes exif. But I can't find out if I've System.Drawing.Image.FromStream or something like it can read and/or write that format.
8
by: infoseekar | last post by:
Does anyone know what's the right code to read IPTC metadata. I have the code to read EXIF metadata and it gives me alot of information which I don't need. How do I modify this code so it only...
1
by: SPE - Stani's Python Editor | last post by:
Phatch is a simple to use cross-platform GUI Photo Batch Processor Phatch handles all popular image formats and can duplicate (sub)folder hierarchies. It can batch resize, rotate, apply...
3
by: sam | last post by:
same as subject?
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.