---
title: "CGImageDestinationCreateWithURL(_:_:_:_:)"
framework: imageio
role: symbol
role_heading: Function
path: "imageio/cgimagedestinationcreatewithurl(_:_:_:_:)"
---

# CGImageDestinationCreateWithURL(_:_:_:_:)

Creates an image destination that writes image data to the specified URL.

## Declaration

```swift
func CGImageDestinationCreateWithURL(_ url: CFURL, _ type: CFString, _ count: Int, _ options: CFDictionary?) -> CGImageDestination?
```

## Parameters

- `url`: The URL at which to write the image data. This object overwrites any data at the specified URL.
- `type`: The uniform type identifier of the resulting image file. For a list of system-declared and third-party identifiers, see doc://com.apple.documentation/documentation/UniformTypeIdentifiers.
- `count`: The number of images (not including thumbnail images) you want to include in the image file.
- `options`: Future options. Specify NULL for this parameter.

## Return Value

Return Value An image destination, or NULL if an error occurs. You are responsible for releasing this object using CFRelease.

## See Also

### Creating an Image Destination

- [CGImageDestinationCreateWithData(_:_:_:_:)](imageio/cgimagedestinationcreatewithdata(_:_:_:_:).md)
- [CGImageDestinationCreateWithDataConsumer(_:_:_:_:)](imageio/cgimagedestinationcreatewithdataconsumer(_:_:_:_:).md)
