在Xamarin表单中使用Exif数据和理解Android path系统时出现问题
我在处理Xamarin表单中的exif数据时遇到问题,我解释道:在Xamarin表单中使用Exif数据和理解Android path系统时出现问题,android,xamarin.forms,xamarin.android,exif,android-storage,Android,Xamarin.forms,Xamarin.android,Exif,Android Storage,我在处理Xamarin表单中的exif数据时遇到问题,我解释道: 我的应用程序使用MediaPlugin拍照,图像路径为 file.Path=“/storage/emulated/0/Android/data/com.companyname.appname/files/Pictures/Sample/someName.jpg” 使用ExifInterface将我的exif数据放在图像上(在同一路径上) 现在问题开始了,如果我在这条路径上使用GetAttribute,我可以看到我的exif数据,
file.Path=
“/storage/emulated/0/Android/data/com.companyname.appname/files/Pictures/Sample/someName.jpg”GetAttribute
,我可以看到我的exif数据,但是如果我从电脑上的“\Phone\Pictures\Sample”物理复制图像并获得详细信息,则不会显示我的exif数据(只有像白平衡等相机数据)
现在我读到/storage/simulated/0/Android/data/..是资源的“主”路径,另一个是“虚拟链接”,但我现在不知道如何到达另一个映像路径
我该怎么办?如何在我的电脑拷贝上的图像中查看exif数据
我希望我的解释清楚最后,我使用了以下解决方法: 我已在ExternalStorage绝对路径中创建了一个新文件夹(即您可以在Windows文件资源管理器中看到的文件夹)
这将创建一个名为“MY_APP”的新文件夹,并在其中复制从CrossMedia返回的图像,您可以在此处保存exif数据您确定要从添加exif数据的同一路径复制图像吗?我怀疑MediaPlugin正在返回您正在添加EXIF数据的图像的副本,但随后您正在从图像库复制照片的原始副本。感谢您的回复,可能是MediaPlugin给了我一个副本,但在这一点上,我不知道如何将我的exif放在原始图像上,因为我不知道路径。我试过使用
string destFolder=Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);ExifInterface newExif=新ExifInterface(destFolder+“/Sample/test_12.jpg”)代码>但它找不到路径,crashI试图使用adb根目录。我打开路径,发现了/storage/emulated/0/Android/data/com.companyname.appname/files/
,/Pictures/Sample/someName.jpg
是虚拟链接,因此我建议您可以将图像(MediaPlugin正在返回给您)复制到公用文件夹中。但现有数据无法访问。感谢您的建议,我试图复制图像,但即使在这里,我也有一些路径问题。。。这里是我的代码:string destFolder=Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),picName);File.Copy(File.Path,destFolder,true)代码>导致错误:“找不到路径的一部分”
ExifInterface newExif = new ExifInterface(file.Path);
newExif.SetAttribute(ExifInterface.TagUserComment, "Hello photo!");
newExif.SaveAttributes();```
var directoryname = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "MY_APP");
Directory.CreateDirectory(directoryname);
string jpgFilename = Path.Combine(directoryname, picName);
File.Copy(file.Path, jpgFilename, true);
ExifInterface newExif = new ExifInterface(jpgFilename);
newExif.SetAttribute(ExifInterface.TagUserComment, "Ketama126");
newExif.SaveAttributes();