Copy EXIF Metadata from TIF to JPEG in C# / VB.NET
Posted
by George
on Stack Overflow
See other posts from Stack Overflow
or by George
Published on 2009-07-02T10:38:43Z
Indexed on
2010/04/21
2:03 UTC
Read the original article
Hit count: 325
Hello! I would really appreciate if you could shed light on this problem. I have 2 images, one was created from TIF file with metadata, the other is an in-memory image that will be saved as jpeg. Then I use this routine to transfer exif metadata from first image to the second one (that is from the one created from tif file to the in-memory image):
For Each _p In image1.PropertyItems
image2.SetPropertyItem(_p)
Next
And this works perfectly fine. All exif items are successfully copied. I confirmed this by using watches in debug mode. The problem comes when you save image2 as jpeg using this:
Dim eps As EncoderParameters = New EncoderParameters(1)
eps.Param(0) = New EncoderParameter(Encoder.Quality, 85)
Dim ici As ImageCodecInfo = GetEncoderInfo("image/jpeg")
image2.Save("C:\1.jpg", ici, eps)
Only very few EXIF properties are saved with image2 jpeg file however, namely only camera model and camera maker. However If I save image2 as TIF, all properties from the original tif will be there. Can anyone explain why is that?
Thanks.
© Stack Overflow or respective owner