Quantcast
Channel: magick Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1011

Commented Unassigned: Unable to write to EXIF or rotate if image has been edited with Windows Photo Viewer [1327]

$
0
0
I was working on a asp.net web application to edit photos, such as rotate them or write information to the EXIF header. Magick.net works great, however, it doesn't work at all if an image is edited, such as rotated, with Windows Photo Viewer on Windows 7. I had to do this...
```
using (MemoryStream memStream = LoadMemoryStreamImage(uncPath))
{
using (MagickImage image = new MagickImage(memStream))
{
ExifProfile profile = image.GetExifProfile();
foreach (ExifValue value in profile.Values)
{
if (value.Tag == ImageMagick.ExifTag.Software)
{
if (!value.ToString().StartsWith("Microsoft Windows Photo Viewer"))
{

profile.SetValue(ImageMagick.ExifTag.Copyright, txtPhotoBy.Text + ", Arkansas Geological Survey");
profile.SetValue(ImageMagick.ExifTag.ImageDescription, txtDescription.Text);
//double[] lat = { 33 / 1 , 42 / 1 , 10253 / 354 };
//profile.SetValue(ImageMagick.ExifTag.GPSLatitude, lat);
//profile.SetValue(ImageMagick.ExifTag.GPSLongitude, Convert.ToUInt32(-92.9594));

image.AddProfile(profile);
image.Write(uncPath);
}
}
}
}
}


bool microPhotoView = false;

using (MemoryStream memStream = LoadMemoryStreamImage(uncPath))
{
using (MagickImage image = new MagickImage(memStream))
{
ExifProfile profile = image.GetExifProfile();
foreach (ExifValue value in profile.Values)
{
if (value.Tag == ImageMagick.ExifTag.Software)
{
//Determining if Photo has been edited/rotated with Microsoft Windows Photo Viewer
if (value.ToString().StartsWith("Microsoft Windows Photo Viewer"))
{
microPhotoView = true;
}

}
}

if (microPhotoView == false)
{
profile.SetValue(ImageMagick.ExifTag.ImageWidth, Convert.ToUInt32(imgHeight));
profile.SetValue(ImageMagick.ExifTag.ImageLength, Convert.ToUInt32(imgWidth));
image.AddProfile(profile);

image.Rotate(90);
image.Write(uncPath);
}
}
}
```
Comments: ** Comment from web user: razor_nate **

I'm unable to rotate or write to the EXIF. When I attempt to do either the web browser's spinner will continue to run and I've let it run for a long time and receive no error messages. Eventually I close the browser and try to go back to the application but it will never load, as if it's still trying to process what I had started before. I have to go restart IIS to rectify the situation. When I get back to work Tuesday, I'll upload a picture.

If I don't use LoadMemoryStreamImage I will occasionally get a message that the file is in use, or something to that effect, when I try to rotate or write to the EXIF.


Viewing all articles
Browse latest Browse all 1011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>