CGImageSource.CreateWithURL
---------------------------

Creates an image source that reads from a location specified by a URL.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CGImageSource](component_CGImageSource.md) | [3.4](newinversion34.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "CGImageSource.CreateWithURL"; URL ) 

**MBS**( **"CGImageSource.CreateWithURL";** /\* Creates an image source that reads from a location specified by a URL. \*/  
**$URL**) /\* The URL to the file. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| URL | The URL to the file. | $URL |

### Result

Returns the reference number for this image source or error message.

### Description

Creates an image source that reads from a location specified by a URL.  
Don't forget to call [CGImageSource.Release](CGImageSourceRelease.md) later to release the reference number.  
CoreGraphics Image Source reference numbers are starting at 25000 and counting up for each new image source.  
### Examples

Loads image and shows it:

 Set Variable \[ $url ; Value: "http://www.monkeybreadsoftware.com/images/fmplugin16.png" \]   
Set Variable \[ $img ; Value: MBS ( "CGImageSource.CreateWithURL"; $url ) \]   
Set Field \[ test::output ; MBS ( "[CGImageSource.ImageAtIndex](CGImageSourceImageAtIndex.md)"; $img ; 0) \]   
Set Variable \[ $r ; Value: MBS ( "[CGImageSource.Release](CGImageSourceRelease.md)"; $img ) \]  
### See also

- [CGImageSource.Count](CGImageSourceCount.md)
- [CGImageSource.CreateWithData](CGImageSourceCreateWithData.md)
- [CGImageSource.HasProperty](CGImageSourceHasProperty.md)
- [CGImageSource.ImageAtIndex](CGImageSourceImageAtIndex.md)
- [CGImageSource.Keys](CGImageSourceKeys.md)
- [CGImageSource.Properties](CGImageSourceProperties.md)
- [CGImageSource.Property](CGImageSourceProperty.md)
- [CGImageSource.Release](CGImageSourceRelease.md)
- [CGImageSource.SetProperty](CGImageSourceSetProperty.md)
- [CGImageSource.Type](CGImageSourceType.md)

This function checks for a license.

Created 18th August 2014 , last changed 4th March 2023

  
[CGImageSource.CreateWithPath](CGImageSourceCreateWithPath.md) - [CGImageSource.Export](CGImageSourceExport.md)

[HTML Version](CGImageSourceCreateWithURL.shtml)