---
title: NSImageRep
framework: appkit
role: symbol
role_heading: Class
path: appkit/nsimagerep
---

# NSImageRep

A semiabstract superclass that provides subclasses that you use to draw an image from a particular type of source data.

## Declaration

```swift
class NSImageRep
```

## Overview

Overview The NSImageRep class is called “semiabstract” because it has some instance variables and implementation of its own, in addition to defining subclasses. Although an NSImageRep subclass can be used directly, it is typically accessed through an NSImage object, which manages a group of image representations, choosing the best one for the current output device.

## Topics

### Creating Representations of Images

- [imageReps(withContentsOfFile:)](appkit/nsimagerep/imagereps(withcontentsoffile:).md)
- [imageReps(with:)](appkit/nsimagerep/imagereps(with:).md)
- [imageReps(withContentsOf:)](appkit/nsimagerep/imagereps(withcontentsof:).md)
- [init(contentsOfFile:)](appkit/nsimagerep/init(contentsoffile:).md)
- [init(pasteboard:)](appkit/nsimagerep/init(pasteboard:).md)
- [init(contentsOf:)](appkit/nsimagerep/init(contentsof:).md)
- [init()](appkit/nsimagerep/init().md)
- [init(coder:)](appkit/nsimagerep/init(coder:).md)

### Determining Types for Images

- [canInit(with:)](appkit/nsimagerep/caninit(with:)-6zv56.md)
- [canInit(with:)](appkit/nsimagerep/caninit(with:)-56pum.md)
- [imageTypes](appkit/nsimagerep/imagetypes.md)
- [imageUnfilteredTypes](appkit/nsimagerep/imageunfilteredtypes.md)
- [imageFileTypes()](appkit/nsimagerep/imagefiletypes().md)
- [imagePasteboardTypes()](appkit/nsimagerep/imagepasteboardtypes().md)
- [imageUnfilteredFileTypes()](appkit/nsimagerep/imageunfilteredfiletypes().md)
- [imageUnfilteredPasteboardTypes()](appkit/nsimagerep/imageunfilteredpasteboardtypes().md)

### Accessing Size of Images

- [size](appkit/nsimagerep/size.md)

### Specifying Information About the Representation

- [bitsPerSample](appkit/nsimagerep/bitspersample.md)
- [colorSpaceName](appkit/nsimagerep/colorspacename.md)
- [hasAlpha](appkit/nsimagerep/hasalpha.md)
- [isOpaque](appkit/nsimagerep/isopaque.md)
- [pixelsHigh](appkit/nsimagerep/pixelshigh.md)
- [pixelsWide](appkit/nsimagerep/pixelswide.md)
- [layoutDirection](appkit/nsimagerep/layoutdirection.md)
- [Device-Specific Value](appkit/device-specific-value.md)

### Getting Core Graphics Images

- [cgImage(forProposedRect:context:hints:)](appkit/nsimagerep/cgimage(forproposedrect:context:hints:).md)

### Drawing Images

- [draw()](appkit/nsimagerep/draw().md)
- [draw(at:)](appkit/nsimagerep/draw(at:).md)
- [draw(in:)](appkit/nsimagerep/draw(in:).md)
- [draw(in:from:operation:fraction:respectFlipped:hints:)](appkit/nsimagerep/draw(in:from:operation:fraction:respectflipped:hints:).md)
- [NSImageRep.HintKey](appkit/nsimagerep/hintkey.md)

### Managing Representation Subclasses of Images

- [class(forType:)](appkit/nsimagerep/class(fortype:).md)
- [class(for:)](appkit/nsimagerep/class(for:).md)
- [registeredClasses](appkit/nsimagerep/registeredclasses.md)
- [registerClass(_:)](appkit/nsimagerep/registerclass(_:).md)
- [unregisterClass(_:)](appkit/nsimagerep/unregisterclass(_:).md)
- [class(forFileType:)](appkit/nsimagerep/class(forfiletype:).md)
- [class(forPasteboardType:)](appkit/nsimagerep/class(forpasteboardtype:).md)

### Notifications

- [registryDidChangeNotification](appkit/nsimagerep/registrydidchangenotification.md)

### Structures

- [NSImageRep.RegistryDidChangeMessage](appkit/nsimagerep/registrydidchangemessage.md)

### Initializers

- [init(contentsOfURL:)](appkit/nsimagerep/init(contentsofurl:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [NSBitmapImageRep](appkit/nsbitmapimagerep.md)
- [NSCIImageRep](appkit/nsciimagerep.md)
- [NSCustomImageRep](appkit/nscustomimagerep.md)
- [NSEPSImageRep](appkit/nsepsimagerep.md)
- [NSPDFImageRep](appkit/nspdfimagerep.md)
- [NSPICTImageRep](appkit/nspictimagerep.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Images

- [Providing images for different appearances](uikit/providing-images-for-different-appearances.md)
- [Supporting Continuity Camera in Your Mac App](appkit/supporting-continuity-camera-in-your-mac-app.md)
- [Supporting HDR images in your app](uikit/supporting-hdr-images-in-your-app.md)
- [Applying Apple HDR effect to your photos](appkit/applying-apple-hdr-effect-to-your-photos.md)
- [NSImage](appkit/nsimage.md)
- [NSImageDelegate](appkit/nsimagedelegate.md)
