4/5/2016 - 2:49 PM


' For complete examples and data files, please go to

                    Dim path As String = Common.MapSourceFilePath(filePath)
                    ' initialize JpegFormat
                    Dim jpegFormat As New JpegFormat(Common.MapSourceFilePath(filePath))

                    ' get image base64 string
                    Dim base64String As String
                    Using image__1 As Image = Image.FromFile(path)
                        Using m As New MemoryStream()
                            image__1.Save(m, image__1.RawFormat)
                            Dim imageBytes As Byte() = m.ToArray()

                            ' Convert byte[] to Base64 String
                            base64String = Convert.ToBase64String(imageBytes)
                        End Using
                    End Using

                    ' create image thumbnail
                    Dim thumbnail As New Thumbnail() With { _
                         .ImageBase64 = base64String _

                    ' initialize array and add thumbnail
                    Dim thumbnails As Thumbnail() = New Thumbnail(0) {}
                    thumbnails(0) = thumbnail

                    ' update thumbnails property in XMP Basic schema
                    jpegFormat.XmpValues.Schemes.XmpBasic.Thumbnails = thumbnails

                    ' commit changes