<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIImage/imageWithData:scale:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIImage(cm)imageWithData:scale:"
  },
  "title" : "imageWithData:scale:"
}
-->

# imageWithData:scale:

Creates and returns an image object that uses the specified image data and scale factor.

```
+ (UIImage *) imageWithData:(NSData *) data scale:(CGFloat) scale;
```

## Parameters

`data`

The image data. This can be data from a file or data you create programmatically.

`scale`

The scale factor to use when interpreting the image data. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the [`size`](/documentation/UIKit/UIImage/size) property.

## Return Value

A new image object for the specified data, or `nil` if the method could not initialize the image from the specified data.

## Discussion

This method does not cache the image object.

---

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)