我发现这个.net库可以从图像中提取元数据,它们给出的示例在下面,但是我输入的任何路径仅给出了对路径的访问权限,因此被拒绝。我以管理员身份运行Visual Studio,所以这不应该成为问题
static void Main(string[] args)
{
var directories = MetadataExtractor.ImageMetadataReader.ReadMetadata("C:\\New folder");
foreach (var directory in directories)
{
foreach (var tag in directory.Tags)
Console.WriteLine($"[{directory.Name}] {tag.Name} = {tag.Description}");
if (directory.HasError)
{
foreach (var error in directory.Errors)
Console.WriteLine($"ERROR: {error}");
}
}
}
答案 0 :(得分:0)
U必须设置文件路径,而不是文件夹路径。我已经尝试过了
C:\\New folder\\maxresdefault.jpg
而且有效。输出:
[JPEG] Compression Type = Baseline
[JPEG] Data Precision = 8 bits
[JPEG] Image Height = 720 pixels
[JPEG] Image Width = 1280 pixels
[JPEG] Number of Components = 3
[JPEG] Component 1 = Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[JPEG] Component 2 = Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JPEG] Component 3 = Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JFIF] Version = 1.1
[JFIF] Resolution Units = inch
[JFIF] X Resolution = 96 dots
[JFIF] Y Resolution = 96 dots
[JFIF] Thumbnail Width Pixels = 0
[JFIF] Thumbnail Height Pixels = 0
[Exif IFD0] X Resolution = 96 dots per inch
[Exif IFD0] Y Resolution = 96 dots per inch
[Exif IFD0] Resolution Unit = Inch
[Exif IFD0] Software = paint.net 4.0.19
[File] File Name = maxresdefault.jpg
[File] File Size = 121177 bytes
[File] File Modified Date = Вт май 29 13:45:59 +03:00 2018