PictureSharp.Tiff
0.5.0
See the version list below for details.
dotnet add package PictureSharp.Tiff --version 0.5.0
NuGet\Install-Package PictureSharp.Tiff -Version 0.5.0
<PackageReference Include="PictureSharp.Tiff" Version="0.5.0" />
<PackageVersion Include="PictureSharp.Tiff" Version="0.5.0" />
<PackageReference Include="PictureSharp.Tiff" />
paket add PictureSharp.Tiff --version 0.5.0
#r "nuget: PictureSharp.Tiff, 0.5.0"
#:package PictureSharp.Tiff@0.5.0
#addin nuget:?package=PictureSharp.Tiff&version=0.5.0
#tool nuget:?package=PictureSharp.Tiff&version=0.5.0
PictureSharp.Tiff
TIFF for PictureSharp, in 100% C#. No native dependencies.
Reads and writes TIFF and BigTIFF on .NET 10+ with PictureSharp 0.7.9+. No native libraries or P/Invoke.
dotnet add package PictureSharp.Tiff
Use
Register the format once; Image.Load, Identify, ReadMetadata, EditMetadata and Save then handle .tif and
.tiff:
using PictureSharp;
using PictureSharp.Formats.Tiff;
ImageConfiguration.Default = ImageConfiguration.Default.ToBuilder().AddFormat(new TiffFormat()).Build();
using var image = Image.Load("scan.tif"); // first page; ICC, EXIF and XMP kept
image.Mutate(x => x.AutoOrient().Resize(1600, 0));
image.SaveAsTiff("small.tif"); // LZW, smallest lossless colour type
image.SaveAsTiff("photo.tif", new TiffEncoderOptions { Compression = TiffCompression.Jpeg, JpegQuality = 90 });
Other pages are selected with TiffDecoderOptions; every frame of an Image is written as a page:
int pages = Image.Identify("fax.tif").ContainerItemCount;
using var second = Image.Load("fax.tif", new DecoderOptions { FormatOptions = [new TiffDecoderOptions { Page = 1 }] });
A library can pass its own configuration through DecoderOptions.Configuration and EncoderOptions.Configuration
instead of changing the default.
Support
| Read | classic TIFF and BigTIFF, both byte orders, strips and tiles, planar; none, PackBits, LZW, Deflate, JPEG, WebP, CCITT RLE, Group 3 and Group 4; greyscale 1–16 bits, palette, RGB and CMYK 8/16 bits, YCbCr, 32-bit float, with or without alpha; one page at a time |
| Write | every frame as a page, strips or tiles, classic TIFF or BigTIFF; none, PackBits, LZW, Deflate, JPEG, WebP and CCITT Group 4; 8-bit grey, grey + alpha, RGB, RGBA, palette and 1-bit black and white; compressed in parallel |
| Metadata | ICC, XMP, EXIF/GPS, orientation and resolution, read and written; EditMetadata without re-encoding |
| Not supported | old-style JPEG, JBIG, LZMA, Zstandard, CIE Lab, signed samples; writing 16-bit, CMYK or planar data |
Limits (MaxPixels, MaxInputBytes, MaxMetadataBytes) and cancellation work as for built-in formats. Decoded pixels
match libtiff 4.5.1 and Pillow 10.2.0; lossless output reads back exactly in both, and LZW, PackBits and Group 4 data
is byte-identical to libtiff's. LZW writing on one thread runs as fast as libtiff, and parallel compression on 16
threads is about 6× faster (measurements).
Guides: decoding · encoding · metadata
0.5.0 release notes: writing
TIFF and BigTIFF, multi-page, tiles, parallel compression and EditMetadata.
License
MIT. Ported sources (libtiff, Pillow conversion rules) and their licenses are listed in THIRD-PARTY-NOTICES.txt. libtiff, Pillow and ImageMagick are used only as test oracles.
Build
dotnet build -c Release
dotnet test -c Release
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- PictureSharp (>= 0.7.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
0.5.0: writing TIFF and BigTIFF: every frame as a page, strips or tiles, None, PackBits, LZW, Deflate, JPEG, WebP and CCITT Group 4, compressed in parallel; Image.EditMetadata for TIFF; WebP compression is read. Requires PictureSharp 0.7.9. Notes: https://github.com/art-ix/PictureSharp.Tiff/blob/v0.5.0/docs/releases/release-0.5.0.md