---
title: "Write a 1D barcode to an image"
canonical_url: "https://www.nutrient.io/guides/dotnet/barcodes/generation/write-1d-barcode-to-image/"
md_url: "https://www.nutrient.io/guides/dotnet/barcodes/generation/write-1d-barcode-to-image.md"
last_updated: "2026-05-04T00:00:00.000Z"
description: "Generate and save 1D barcode images with Nutrient .NET SDK."
---

# Write a 1D barcode to an image

This guide shows how to generate a one-dimensional (1D) barcode and write it to an image.

Use this workflow when you need to:

- Generate barcode labels for products or assets

- Create machine-readable identifiers in automated pipelines

- Export barcodes for print or digital distribution

## Prepare the project

Register the SDK license before running barcode operations. For setup details, refer to the [getting started with.NET SDK](https://www.nutrient.io/sdk/dotnet/getting-started.md) guide.

```csharp

using GdPicture14;

LicenseManager licence = new LicenseManager();
licence.RegisterKEY(""); // Set your license key

```

## Create the image canvas

Create a blank image to host the barcode:

```csharp

using GdPictureImaging imaging = new GdPictureImaging();

// Create a new image canvas with specified dimensions and color depth
int imageId = imaging.CreateNewGdPictureImage(600, 300, 32, imaging.ARGBI(255, 255, 255, 255));

```

## Generate the 1D barcode

Write the barcode value to the image:

```csharp

// Generate 1D barcode with specified data and formatting parameters
imaging.Barcode1DWrite(imageId, GdPicture14.Barcode1DWriterType.Barcode1DWriterCode128,
                       "https://www.nutrient.io", 50, 50, 400, 100,
                       imaging.ARGBI(255, 0, 0, 0), BarcodeAlign.BarcodeAlignLeft, 0);

```

## Save the output image

Export the barcode image as PNG:

```csharp

// Save the generated barcode image as PNG format
imaging.SaveAsPNG(imageId, @"output_barcode_1d.png");

```

## Supported barcode types

The SDK supports common 1D formats, including:

- Code 128

- Code 39

- UPC-A and UPC-E

- EAN-13 and EAN-8

- Code 93

- Interleaved 2 of 5

## Conclusion

This workflow writes a 1D barcode to an image file that you can print, store, or pass to downstream systems.
---

## Related pages

- [Generate barcodes in C#](/guides/dotnet/barcodes/generation.md)
- [Generate 1D barcodes in C#](/guides/dotnet/barcodes/generation/1d-linear.md)
- [Generate Aztec barcodes in C# .NET](/guides/dotnet/barcodes/generation/aztec-code.md)
- [Generate Data Matrix barcodes in C# .NET](/guides/dotnet/barcodes/generation/datamatrix.md)
- [Generate MaxiCode barcodes in C# .NET](/guides/dotnet/barcodes/generation/maxicode.md)
- [Generate Micro QR codes in C# .NET](/guides/dotnet/barcodes/generation/microqr.md)
- [Generate PDF417 barcodes in C# .NET](/guides/dotnet/barcodes/generation/pdf417.md)
- [Generate QR codes with C# .NET](/guides/dotnet/barcodes/generation/qr.md)
- [Write a QR code to an image](/guides/dotnet/barcodes/generation/write-qr-code-to-image.md)

