How can i find the file type after loading NSImage withContentsOfFile

寵の児 提交于 2019-12-12 00:53:32

问题


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.

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


回答1:


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.



来源:https://stackoverflow.com/questions/3590003/how-can-i-find-the-file-type-after-loading-nsimage-withcontentsoffile

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!