goldengel / exiflibrary

Automatically exported from code.google.com/p/exiflibrary
MIT License
0 stars 0 forks source link

Removing GPS Data From JPEG Images Written with the Library #45

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
GPS Image data remains in the image.  This only happens on images which have 
previously been encoded with GPS data from the library.  I wrote one utility to 
encode GPS data in images, and one utility to remove GPS data from images.  The 
removal tool works fine on outside images, but will not remove the GPS data 
from images encoded with the library.  I found a workaround which I will detail 
below.

What version of the product are you using? On what operating system?
version 0.18 on Windows Server 2008R2.  

Is this issue specific to a certain image? If so, please attach the zipped
image. Please take the time to do this; otherwise I may not be able to
reproduce the issue. IMPORTANT: Please zip the image and attach the zip
file to prevent
the image being re-encoded.

Please provide any additional information below.

The function being used to clear the GPS data is below, however on images 
encoded with the library, the output still contains GPS data:
private MemoryStream clearExif(Stream fileStream){
                ImageFile file = ImageFile.FromStream(fileStream);
                MemoryStream output = new MemoryStream();
                file.Properties.Remove(IFD.GPS);
                file.Save(output);
                return output;
            }

        }

If I go into JPEGFile.cs and modify this line by commenting out the return 
false, the GPS information is removed.  Once again, this is only necessary with 
images encoded using the library.  I will also attach one of the images:

            if (ifdzeroth.Count == 0 && ifdgps.Count == 0 && ifdinterop.Count == 0 && ifdfirst.Count == 0 && Thumbnail == null)
            {
                // Nothing to write
                //return false;
            }

Thanks for the great library !!

Original issue reported on code.google.com by ireland...@gmail.com on 20 Jun 2013 at 11:06

Attachments: