GMImage.SetProfile
------------------

Add or remove a named profile to/from the image.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [GraphicsMagick](component_GraphicsMagick.md) | [2.0](newinversion20.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "GMImage.SetProfile"; ImageRef; Name; Data ) 

**MBS**( **"GMImage.SetProfile";** /\* Add or remove a named profile to/from the image. \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$Name**; /\* The string with the name of the profile.e.g. "IPTC" \*/   
**$Data**) /\* The container field value with the embedded profile file. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| Name | The string with the name of the profile. | "IPTC" |
| Data | The container field value with the embedded profile file. |  |

### Result

Returns "OK" on success.

### Description

Add or remove a named profile to/from the image.   
Remove the profile by passing an empty container field. Valid names are "\*", "8BIM", "ICM", "IPTC", "EXIF", or a user/format-defined profile name.  
### Examples

Remove XMP:

 Set Variable \[$Result ; Value:MBS ( "GMImage.SetProfile"; $imageRef ; "XMP"; "" )\]  
Remove IPTC:

 Set Variable \[$Result ; Value:MBS ( "GMImage.SetProfile"; $imageRef ; "IPTC"; "" )\]  
Remove EXIF:

 Set Variable \[$Result ; Value:MBS ( "GMImage.SetProfile"; $imageRef ; "EXIF"; "" )\]  
Clear all profiles:

 Set Variable \[ $Image ; Value: MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; MyTable::BMPContainer ) \]   
\# remove metadata   
Set Variable \[$Result ; Value:MBS ( "GMImage.SetProfile"; $Image ; "EXIF"; "" )\]   
Set Variable \[$Result ; Value:MBS ( "GMImage.SetProfile"; $Image ; "IPTC"; "" )\]   
Set Variable \[$Result ; Value:MBS ( "GMImage.SetProfile"; $Image ; "XMP"; "" )\]  
\# write back as JPEG   
Set Variable \[ $r ; Value: MBS ("[GMImage.SetQuality](GMImageSetQuality.md)";$Image ; 90) \]   
Set Field \[ MyTable::JPEGContainer ; MBS ("[GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)"; $Image ) \]   
Set Variable \[ $r ; Value: MBS ("[GMImage.Release](GMImageRelease.md)";$Image ) \]  
Copy IPTC data to a new picture:

 # load a picture   
Set Variable \[ $img ; Value: MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; IPTC::InputImage ) \]   
\# make a new one   
Set Variable \[ $newImage ; Value: MBS ("[GMImage.New](GMImageNew.md)"; "100x100"; "white") \]   
\# read metadata and put it on the new picture   
Set Variable \[ $data ; Value: MBS ( "[GMImage.GetProfile](GMImageGetProfile.md)"; $img ; "IPTC" ) \]   
Set Variable \[ $r ; Value: MBS ( "GMImage.SetProfile"; $newImage ; "IPTC"; $data ) \]   
\# write to file   
Set Variable \[ $r ; Value: MBS ( "[GMImage.WriteToFile](GMImageWriteToFile.md)"; $newImage ; "/Users/cs/Desktop/Import.jpg" ) \]   
\# and free memory   
Set Variable \[ $r ; Value: MBS ( "[GMImage.Release](GMImageRelease.md)"; $newImage ) \]   
Set Variable \[ $r ; Value: MBS ( "[GMImage.Release](GMImageRelease.md)"; $img ) \]  
### See also

- [Container.ReadImage](ContainerReadImage.md)
- [GMImage.New](GMImageNew.md)
- [GMImage.NewFromFile](GMImageNewFromFile.md)
- [GMImage.Profiles](GMImageProfiles.md)
- [GMImage.Release](GMImageRelease.md)
- [GMImage.Scale](GMImageScale.md)
- [GMImage.SetIPTCProfile](GMImageSetIPTCProfile.md)
- [GMImage.SetQuality](GMImageSetQuality.md)
- [GMImage.WriteToFile](GMImageWriteToFile.md)
- [GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)

### Release notes

- **Version 8.4**
    - Fixed crash with [GMImage.SetIPTCProfile](http://www.mbsplugins.eu/GMImageSetIPTCProfile.shtml), [GMImage.SetICCColorProfile](http://www.mbsplugins.eu/GMImageSetICCColorProfile.shtml) and [GMImage.SetProfile](http://www.mbsplugins.eu/GMImageSetProfile.shtml) if called with empty parameter.

### Example Databases

- [Containers/Create Container Preview](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Containers/Create%20Container%20Preview.shtml#1ScriptAnchor_)

### Blog Entries

- [Create thumbnail with GraphicsMagick](https://www.mbsplugins.de/archive/2023-04-15/Create_thumbnail_with_Graphics/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.4pr6](https://www.mbsplugins.de/archive/2018-09-01/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 22nd August 2022

  
[GMImage.SetPixelColor](GMImageSetPixelColor.md) - [GMImage.SetQuality](GMImageSetQuality.md)

[HTML Version](GMImageSetProfile.shtml)