<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCustomImageRep",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCustomImageRep"
  },
  "title" : "NSCustomImageRep"
}
-->

# NSCustomImageRep

An object that uses a delegate object to render an image from a custom format.

```
class NSCustomImageRep
```

## Overview

When called upon to produce an image, an [`NSCustomImageRep`](/documentation/AppKit/NSCustomImageRep) sends a message to its delegate to do the actual drawing. You can use this class to support custom image formats without going to the trouble of subclassing [`NSImageRep`](/documentation/AppKit/NSImageRep) directly.

## Topics

### Creating Representations of Images in Custom Formats

[`-  initWithDrawSelector:delegate:`](/documentation/AppKit/NSCustomImageRep/init(draw:delegate:))

Returns a representation of an image initialized with the specified delegate information.

[`-  initWithSize:flipped:drawingHandler:`](/documentation/AppKit/NSCustomImageRep/init(size:flipped:drawingHandler:))

Initializes a representation of an image of the specified size and flipped status, using a block to draw its content.

### Getting Drawing Handlers

[`drawingHandler`](/documentation/AppKit/NSCustomImageRep/drawingHandler)

The destination rectangle of the drawing handler block.

### Getting Information About Images

[`delegate`](/documentation/AppKit/NSCustomImageRep/delegate)

The delegate object that renders the image for the image representation.

[`drawSelector`](/documentation/AppKit/NSCustomImageRep/drawSelector)

The selector for the delegate’s drawing method.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

### Inherits From

[`NSImageRep`](/documentation/AppKit/NSImageRep)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)