Bsa.Pdf.Jpeg
1.1.1
dotnet add package Bsa.Pdf.Jpeg --version 1.1.1
NuGet\Install-Package Bsa.Pdf.Jpeg -Version 1.1.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="Bsa.Pdf.Jpeg" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bsa.Pdf.Jpeg" Version="1.1.1" />
<PackageReference Include="Bsa.Pdf.Jpeg" />
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 Bsa.Pdf.Jpeg --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bsa.Pdf.Jpeg, 1.1.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 Bsa.Pdf.Jpeg@1.1.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=Bsa.Pdf.Jpeg&version=1.1.1
#tool nuget:?package=Bsa.Pdf.Jpeg&version=1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bsa.Pdf.Jpeg
JPEG encoding in pure C#: no native libraries, no System.Drawing, no ImageSharp. Works wherever .NET 6, .NET 8 or .NET 10 runs — Windows, Linux, macOS.
- Baseline JPEG (sequential, standard Huffman tables) in a JFIF file — readable by any software and embeddable in PDF as is with the DCTDecode filter.
- Grayscale (one component) and YCbCr color with 4:2:0 or 4:4:4 chroma subsampling.
- Quality 1…100 with the same quantization tables as libjpeg: files of the same size and look as from familiar tools.
- Input pixels: Gray8, RGB, BGR, BGRA, RGBA with any row stride (alpha is ignored).
Documentation in Russian: README.ru.md in the package.
Installation
dotnet add package Bsa.Pdf.Jpeg
Example
using System.IO;
using Bsa.Pdf.Jpeg;
// BGRA pixels (for example, from PDFium or SkiaSharp), row stride in bytes.
var source = new JpegSource(width, height, stride, JpegPixelFormat.Bgra32, pixels);
var jpeg = JpegEncoder.Encode(source, new JpegEncoderOptions { Quality = 80 });
File.WriteAllBytes("page.jpg", jpeg);
// Straight into a stream.
using var file = File.Create("page.jpg");
JpegEncoder.Encode(source, new JpegEncoderOptions(), file);
Options (JpegEncoderOptions)
| Option | Default | Effect |
|---|---|---|
Quality |
75 | Quality 1…100. 75 is typical, 85–90 is high, below 50 artifacts become visible |
Subsampling |
Chroma420 |
Chroma420 — color at half resolution on both axes (smaller file), Chroma444 — no subsampling (sharper color edges) |
Grayscale |
false | Write grayscale from color pixels. Gray8 input is always written as grayscale |
Limitations
- Encoding only; JPEG decoding is not included.
- No progressive mode, arithmetic coding, CMYK, EXIF or ICC metadata.
- Images up to 65535 × 65535 pixels (format limit).
PNG output
Bsa.Pdf.Jpeg.Imaging.PngEncoder.EncodeBgra(width, height, stride, pixels) creates an 8-bit RGBA PNG
from straight-alpha BGRA pixels. Row padding is supported. For example,
use it with pixels supplied by PDFium or an image decoder.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.