TIFF.NET 1.0.2

dotnet add package TIFF.NET --version 1.0.2
                    
NuGet\Install-Package TIFF.NET -Version 1.0.2
                    
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="TIFF.NET" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TIFF.NET" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="TIFF.NET" />
                    
Project file
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 TIFF.NET --version 1.0.2
                    
#r "nuget: TIFF.NET, 1.0.2"
                    
#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.
#addin nuget:?package=TIFF.NET&version=1.0.2
                    
Install TIFF.NET as a Cake Addin
#tool nuget:?package=TIFF.NET&version=1.0.2
                    
Install TIFF.NET as a Cake Tool

TIFF.NET

Introduction

This is a .NET library for reading TIFF files. It is based on the TIFF 6.0 specification and supports all the compression types and color spaces defined in the specification.

Design

  1. Load a TIFF object from a stream. The TIFF object contains the header and the IFD.
  2. Get necessary information from the TIFF header/IFD/de.
  3. Get the image data from a stream/memory mapped file.
  4. Get the image data from a remote stream.

Sample

        using var reader = new BinaryReader(stream);
        var tiff = TIFF.Load(stream); // cache this object
        
        var memoryMappedFile = MemoryMappedFile.CreateFromFile("path", FileMode.Open, null, 0L, MemoryMappedFileAccess.Read)
        using var viewAccessor = memoryMappedFile.CreateViewAccessor(0, 0, MemoryMappedFileAccess.Read);
        var byteAccessor = new MemoryMappedViewByteAccessor(accessor);
        // var bytes = await tiff.GetBytesAsync(byteAccessor, 0, 0, 0);
        var imageBytes = await tiff.GetTileAsync(byteAccessor, 0, 0, 0); // RGB int[]
        var handle = GCHandle.Alloc(data, GCHandleType.Pinned);
        // save image via SkiaSharp
        try
        {
            using var skiaImage =
                SKImage.FromPixels(
                    new SKImageInfo(512, 512, SKColorType.Rgba8888, SKAlphaType.Premul),
                    handle.AddrOfPinnedObject());
            using var bitmap = SKBitmap.FromImage(skiaImage);
            using var imageStream = new MemoryStream();
            bitmap.Encode(imageStream, SKEncodedImageFormat.Png, 100);
            File.WriteAllBytes("image_path", imageStream.ToArray());
        }
        finally
        {
            handle.Free();
        }

HTTP Range Request


using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

namespace TagImageFileFormat;

public class HttpRangeByteAccessor(string url) : IByteAccessor
{
    private static readonly HttpClient HttpClient = new();

    public async Task<byte[]> ReadBytes(long offset, int length)
    {
        var request = new HttpRequestMessage(HttpMethod.Get, url);
        request.Headers.Range = new RangeHeaderValue(offset, length);
        var response = await HttpClient.SendAsync(request);
        var bytes = await response.Content.ReadAsByteArrayAsync();
        return bytes;
    }
}

Product 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 is compatible.  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 is compatible.  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. 
.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 was computed. 
.NET Framework net45 is compatible.  net451 is compatible.  net452 is compatible.  net46 was computed.  net461 is compatible.  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.

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
1.0.2 154 3/21/2025