Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Supported Image File Formats

Cocoa supports many common image formats internally and can import image data from many more formats through the use of the Image I/O framework (ImageIO.framework).

In this section:

Basic Formats
TIFF Compression
Support for Other File Formats


Basic Formats

Table 6-5 lists the formats supported natively by Cocoa. (Uppercase versions of the filename extensions are also recognized.)

Table 6-5  Cocoa supported file formats

Format

Filename extensions

UTI

Portable Document Format (PDF)

.pdf

com.adobe.pdf

Encapsulated PostScript (EPS)

.eps, .epi, .epsf, .epsi, .ps

Tagged Image File Format (TIFF)

.tiff, .tif

public.tiff

Joint Photographic Experts Group (JPEG), JPEG-2000

.jpg, .jpeg, .jpe

public.jpeg, public.jpeg-2000

Graphic Interchange Format (GIF)

.gif

com.compuserve.gif

Portable Network Graphic (PNG)

.png

public.png

Macintosh Picture Format (PICT)

.pict, .pct, .pic

com.apple.pict

Windows Bitmap Format (DIB)

.bmp, .BMPf

com.microsoft.bmp

Windows Icon Format

.ico

com.microsoft.ico

Icon File Format

.icns

com.apple.icns

TIFF Compression

TIFF images can be read from compressed data, as long as the compression algorithm is one of the four schemes described in Table 6-6.

Table 6-6  TIFF compression settings

Compression

Description

LZW

Compresses and decompresses without information loss, achieving compression ratios up to 5:1. It may be somewhat slower to compress and decompress than the PackBits scheme.

PackBits

Compresses and decompresses without information loss, but may not achieve the same compression ratios as LZW.

JPEG

JPEG compression is no longer supported in TIFF files, and this factor is ignored.

CCITTFAX

Compresses and decompresses 1 bit gray-scale images using international fax compression standards CCITT3 and CCITT4.

An NSImage object can also produce compressed TIFF data using any of these schemes. To get the TIFF data, use the TIFFRepresentationUsingCompression:factor: method of NSImage.

Support for Other File Formats

In Mac OS X v10.4 and later, NSImage supports many additional file formats using the Image I/O framework. To get a complete list of supported filename extensions, use the imageFileTypes class method of NSImage. The list of supported file formats continues to grow but Table 6-7 lists some of the more common formats that can be imported.

Table 6-7  Additional formats supported by Cocoa

Type

Filename extension

Adobe RAW

.dng

Canon 2 RAW

.cr2

Canon RAW

.crw

FlashPix

.fpx, .fpix

Fuji RAW

.raf

Kodak RAW

.dcr

MacPaint

.ptng, .pnt, .mac

Minolta RAW

.mrw

Nikon RAW

.nef

Olympus RAW

.orf

OpenEXR

.exr

Photoshop

.psd

QuickTime Import Format

.qti, .qtif

Radiance

.hdr

SGI

.sgi

Sony RAW

.srf

Targa

.targa, .tga

Windows Cursor

.cur

XWindow bitmap

.xbm

The Image I/O framework is part of Quartz, although the actual framework is part of the Application Services framework. Image I/O handles the importing and exporting of many file formats. To use Quartz directly, you read image data using the CGImageSource opaque type and write using the CGImageDestination type. For more information on using the Image I/O framework to read and write images, see CGImageSource Reference and CGImageDestination Reference.



< Previous PageNext Page > Hide TOC


Last updated: 2007-10-31




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice