<!--
{
  "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/init(data:scale:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIImage(im)initWithData:scale:"
  },
  "title" : "init(data:scale:)"
}
-->

# init(data:scale:)

Initializes and returns the image object with the specified data and scale factor.

```
init?(data: Data, scale: CGFloat)
```

## Parameters

`data`

The data object containing the image data.

`scale`

The scale factor to assume when interpreting the image data. Applying 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

An initialized `UIImage` object, or `nil` if the method could not initialize the image from the specified data.

## Discussion

The data in the `data` parameter must be formatted to match the file format of one of the system’s supported image types.

---

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)