ServerUtils.Base64ToIcon Method
Converts a base64 string (IProfile.IconData) to a PNG image.
Description
This method takes a base64-encoded string (typically stored in the IProfile.IconData property) and converts it to an Image object that can be used to display the icon in the user interface.
Syntax
public static Image Base64ToIcon(string data);
Parameters
| Parameter | Type | Description |
|---|---|---|
data |
string |
The image encoded in base64 format |
Return Value
Type: Image
Returns an Image object representing the decoded PNG image.
Example
Server server = new Server();
// Get the icon from a profile
foreach (var profile in server.Profiles)
{
// Convert IconData (base64) to image
Image icon = ServerUtils.Base64ToIcon(profile.IconData);
// Use the image in a PictureBox
pictureBox1.Image = icon;
}