SkiaSharp.Tiff
0.0.1
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package SkiaSharp.Tiff --version 0.0.1
NuGet\Install-Package SkiaSharp.Tiff -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SkiaSharp.Tiff" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SkiaSharp.Tiff" Version="0.0.1" />
<PackageReference Include="SkiaSharp.Tiff" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SkiaSharp.Tiff --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SkiaSharp.Tiff, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SkiaSharp.Tiff@0.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SkiaSharp.Tiff&version=0.0.1
#tool nuget:?package=SkiaSharp.Tiff&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SkiaSharp.Tiff
TIFF image format encoding and decoding support for SkiaSharp, providing full support for multi-page TIFF files, various compression algorithms, and EXIF metadata.
Features
- Encode & Decode: Full support for both reading and writing TIFF files
- Multi-page TIFF: Create and read multi-page TIFF documents
- Multiple Compressions: LZW, Deflate, JPEG, PackBits, and uncompressed
- Color Spaces: RGB, RGBA (with alpha channel), and grayscale
- EXIF Metadata: Read EXIF tags including orientation
- Cross-platform: Works on Windows, macOS, Linux, iOS, and Android
- Multiple Frameworks: Supports .NET Standard 2.0, 2.1, .NET 6.0, and .NET 8.0
Installation
dotnet add package SkiaSharp.Tiff
Or via NuGet Package Manager:
Install-Package SkiaSharp.Tiff
Quick Start
Decoding TIFF Images
using SkiaSharp;
using SkiaSharp.Tiff;
// Decode from file
using var bitmap = TiffDecoder.Decode("image.tiff");
// Decode from stream
using var stream = File.OpenRead("image.tiff");
using var bitmap = TiffDecoder.Decode(stream);
// Decode from byte array
byte[] data = File.ReadAllBytes("image.tiff");
using var bitmap = TiffDecoder.Decode(data);
// Async decoding
using var bitmap = await TiffDecoder.DecodeAsync("image.tiff");
Encoding TIFF Images
using SkiaSharp;
using SkiaSharp.Tiff;
using SkiaSharp.Tiff.Options;
using SkiaSharp.Tiff.Enums;
// Encode with default options (LZW compression)
byte[] tiffData = TiffEncoder.Encode(bitmap);
// Save to file
TiffEncoder.Save(bitmap, "output.tiff");
// With custom options
var options = new TiffEncodingOptions
{
Compression = TiffCompression.Deflate,
ResolutionDpi = 300
};
TiffEncoder.Save(bitmap, "output.tiff", options);
// JPEG compression (lossy, smaller files)
var jpegOptions = TiffEncodingOptions.WithJpeg(quality: 85);
TiffEncoder.Save(bitmap, "output.tiff", jpegOptions);
Multi-Page TIFF
// Create multi-page TIFF
var bitmaps = new List<SKBitmap> { page1, page2, page3 };
TiffEncoder.SaveMultiPage(bitmaps, "document.tiff");
// Read all pages
var pages = TiffDecoder.DecodeAllPages("document.tiff");
// Read specific page
using var page2 = TiffDecoder.DecodePage("document.tiff", pageIndex: 1);
// Get page count
int pageCount = TiffDecoder.GetPageCount("document.tiff");
Full Image Info with Metadata
using var info = TiffDecoder.DecodeWithInfo("image.tiff");
Console.WriteLine($"Size: {info.ImageInfo.Width}x{info.ImageInfo.Height}");
Console.WriteLine($"Has Alpha: {info.HasAlpha}");
Console.WriteLine($"Pages: {info.PageCount}");
// Access EXIF metadata
if (info.Exif != null)
{
Console.WriteLine($"Camera: {info.Exif.Make} {info.Exif.Model}");
Console.WriteLine($"Date: {info.Exif.DateTimeOriginal}");
}
// Get oriented image (applies EXIF rotation)
using var oriented = info.GetOrientedImage();
Extension Methods
using SkiaSharp.Tiff.Extensions;
// From TIFF (static methods)
var bitmap = SKBitmapTiffExtensions.FromTiff("image.tiff");
// To TIFF (extension methods)
byte[] tiffData = bitmap.ToTiff();
bitmap.SaveAsTiff("output.tiff");
// Convert to other formats
bitmap.SaveAsPng("output.png");
bitmap.SaveAsJpeg("output.jpg", quality: 90);
bitmap.SaveAsWebp("output.webp", quality: 85);
Validation
// Check if data is valid TIFF
bool canDecode = TiffDecoder.CanDecode(stream);
bool canDecode = TiffDecoder.CanDecode(headerBytes);
// Safe decoding with TryDecode
if (TiffDecoder.TryDecode("image.tiff", out var bitmap))
{
// Use bitmap
bitmap.Dispose();
}
// Get info without full decode
var info = TiffDecoder.GetImageInfo("image.tiff");
if (info.HasValue)
{
Console.WriteLine($"Size: {info.Value.Width}x{info.Value.Height}");
}
Compression Options
| Compression | Type | Best For |
|---|---|---|
None |
Uncompressed | Maximum quality, fast processing |
Lzw |
Lossless | General purpose (default) |
Deflate |
Lossless | Smaller files, good compression |
Jpeg |
Lossy | Photos, smallest files |
PackBits |
Lossless | Simple RLE, fast |
Encoding Options
var options = new TiffEncodingOptions
{
Compression = TiffCompression.Lzw, // Compression algorithm
JpegQuality = 90, // Quality for JPEG (1-100)
BitsPerSample = 8, // Bit depth
IncludeAlpha = true, // Include alpha channel
ResolutionDpi = 300, // DPI for both X and Y
Software = "MyApp" // Software tag
};
Decoding Options
var options = new TiffDecodingOptions
{
PageIndex = 0, // Page to decode (0-based)
ApplyOrientation = true, // Apply EXIF orientation
IgnorePageErrors = false // Skip corrupted pages
};
using var bitmap = TiffDecoder.Decode("image.tiff", options);
Sample Application
The included console converter demonstrates all features:
# Convert TIFF to other formats
ConsoleConverter decode photo.tiff photo.png
ConsoleConverter decode photo.tiff photo.jpg --quality 85
# Convert to TIFF
ConsoleConverter encode photo.png photo.tiff --compression deflate
# Show TIFF information
ConsoleConverter info document.tiff
# Extract pages from multi-page TIFF
ConsoleConverter pages document.tiff ./extracted/
# Merge images into multi-page TIFF
ConsoleConverter merge page1.png page2.png page3.png output.tiff
Requirements
- .NET Standard 2.0+ / .NET 6.0+ / .NET 8.0+
- SkiaSharp 2.88.7+
- BitMiracle.LibTiff.NET 2.4.649+
License
MIT License - see LICENSE file for details.
Acknowledgments
- SkiaSharp - Cross-platform 2D graphics library
- LibTiff.NET - Pure .NET TIFF library
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- BitMiracle.LibTiff.NET (>= 2.4.649)
- Microsoft.Bcl.HashCode (>= 1.1.1)
- SkiaSharp (>= 2.88.7)
- System.Memory (>= 4.5.5)
-
.NETStandard 2.1
- BitMiracle.LibTiff.NET (>= 2.4.649)
- SkiaSharp (>= 2.88.7)
-
net6.0
- BitMiracle.LibTiff.NET (>= 2.4.649)
- SkiaSharp (>= 2.88.7)
-
net8.0
- BitMiracle.LibTiff.NET (>= 2.4.649)
- SkiaSharp (>= 2.88.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1 | 129 | 1/26/2026 |