# PictureSource.FromBytes Method

> PictureSource.FromBytes method in the TX Sheet Control .NET API: Creates or updates a document-bound handle or queued operation.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > PictureSource > PictureSource.FromBytes Method
- **731 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/picturesource/frombytes-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/picturesource/frombytes-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/picturesource/frombytes-method/llms-full.txt

---

Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.

### Syntax

```csharp
public static PictureSource FromBytes(byte[] bytes, string? mimeType = null, string? altText = null)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `bytes` | `byte[]` | No | Input workbook bytes owned by the caller. |
| `mimeType` | `string?` | Yes | Operation-specific input; see this type's units and ownership contract. |
| `altText` | `string?` | Yes | Operation-specific input; see this type's units and ownership contract. |

### Return Value

`PictureSource`. The operation result, returned asynchronously.

### Examples

Create a working document workflow using PictureSource. Return the generated document or application data to the caller.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> BuildPictureSourceFromBytesAsync(ServerSheetControl control, byte[] logoPng)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    var logo = PictureSource.FromBytes(logoPng, "image/png", "Alpine Design logo");
    await sheet.Drawings.AddPictureAsync(new { source = logo, anchor = new { cell = "A1" }, size = new { width = 160, height = 60 } });
    return await control.SaveAsync(StreamType.PDF);
}
```

### Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

### See Also

- [PictureSource Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/picturesource/llms-full.txt)
- [Pictures and Shapes](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/pictures-shapes/llms-full.txt)

---

## Nearby

- **Previous:** [PictureSource.Base64 Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/picturesource/base64-property/llms-full.txt)
- **Next:** [PictureSource.MimeType Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/picturesource/mimetype-property/llms-full.txt)
