加载带有ContentsOfFile的NSImage后如何查找文件类型 [英] How can i find the file type after loading NSImage withContentsOfFile

查看:94
本文介绍了加载带有ContentsOfFile的NSImage后如何查找文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道在我用 initWithContentsOfFie加载的文件中使用了哪种图像文件类型,因为我不想信任文件扩展名。

I need to know which image file type was used in the file i loaded with "initWithContentsOfFie" because i don't want to trust the file extension.

不幸的是我在NSImage和NSImageRep中找不到有关格式的任何信息,

Unfortunately i can't find anything about the format in NSImage and NSImageRep,

推荐答案

NSImage 不会保留该信息,因为它不再有用。您需要下拉至 CGImageSource 以获得所需的信息。

NSImage doesn't keep that information, because it's of no further use. You'll need to drop down to CGImageSource to get the info you want.

这篇关于加载带有ContentsOfFile的NSImage后如何查找文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆