<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImage/isDataRetained",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImage(im)isDataRetained"
  },
  "title" : "isDataRetained"
}
-->

# isDataRetained

Returns a Boolean value that incidates whether the image retains its source image data.

```
- (BOOL) isDataRetained;
```

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the image retains its source data; otherwise, <doc://com.apple.documentation/documentation/Swift/false>. The default value is <doc://com.apple.documentation/documentation/Swift/false> with some exceptions, which are covered in the discussion.

## Discussion

For image objects initialized using either the [`init(byReferencingFile:)`](/documentation/AppKit/NSImage/init(byReferencingFile:)) or [`init(byReferencing:)`](/documentation/AppKit/NSImage/init(byReferencing:)) method, this value is <doc://com.apple.documentation/documentation/Swift/true> by default. The reason is that for these methods, data retention simply involves retaining the filename or URL.

Data retention increases the memory used by the `NSImage` object and its image representations.

---

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)