wpf - 使用WPF Imaging类-在不读取整个文件的情况下获取图像尺寸

标签 wpf image image-processing file-io metadata

链接this post我希望能够读取图像文件的高度和宽度,而无需将整个文件读入内存。

在帖子中Frank Krueger提到了一些WPF Imaging类可以做到这一点。关于如何执行此操作的任何想法?

最佳答案

应该这样做:

var bitmapFrame = BitmapFrame.Create(new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg"), BitmapCreateOptions.DelayCreation, BitmapCacheOption.None);
var width = bitmapFrame.PixelWidth;
var height = bitmapFrame.PixelHeight;

关于wpf - 使用WPF Imaging类-在不读取整个文件的情况下获取图像尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/784734/

相关文章:

WPF ObjectDataProvider 参数

java - 无法调整word文档中的图像大小

python - OpenCV:任意大的轮廓集之间的最小距离(Python)

python ,OpenCV : unable to make custom LBP cascade using opencv_traincascade

c# - WPF (C#) 的优秀开源报告工具/框架

c# - 8 位 PNG 上的 OutOfMemory 异常

c# - PngBitmapDecoder 流问题

image - 如何从 URL 获取图像到 Flutter 中的文件?

image - Love2d旋转图像

ios - 使用 iphone/ipad 扫描或阅读答卷上包含光学标记的图像