tags:

views:

24

answers:

1

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  A: 

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.

Mike Abdullah
Lothar: Of note: None of the image classes represents an image *file*, largely because the image might never have been a file (you might have created it yourself in memory and not yet saved it). They are images only. Hence the existence of other classes for working with image files: Giving you information about image files, as well as giving you the images in them, is CGImageSource's and, for PDF files, CGPDFDocument's/PDFDocument's job.
Peter Hosey