You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am creating a 1 page JPEG encoded TIFF image. I would like to be able to set the sampling factor for the page but no matter what I try (see console app below) the value of the YCbCr Subsampling tag always defaults to 1, 1 in the image.
Steps to Reproduce
This is a simple example to reproduce the issue and demonstrate the steps I have taken. (I am using proper images in my development code).
using ImageMagick;
using ImageMagick.Formats;
// For the purposes of demonstration create a simple blank image.
using MagickImage image = new(MagickColors.Red, 2550, 3450);
image.Settings.Verbose = true;
image.Settings.Debug = true;
image.Format = MagickFormat.Tif;
image.Density = new Density(300);
image.ColorType = ColorType.TrueColor;
image.ColorSpace = ColorSpace.YCbCr;
image.SetCompression(CompressionMethod.JPEG);
// I've tried all of these with values 4:2:0, 2x1, 4:2:2 and 2x2
// but none of them change the YCbCr Subsampling tag from the default 1, 1.
//
// image.Settings.SetDefine(MagickFormat.Tif, "sampling-factor", "4:2:0");
// image.Settings.SetDefine(MagickFormat.Tiff, "sampling-factor", "4:2:0");
// image.Settings.SetDefine(MagickFormat.Jpg, "sampling-factor", "4:2:0");
// image.Settings.SetDefine(MagickFormat.Jpeg, "sampling-factor", "4:2:0");
// image.Settings.SetDefine("sampling-factor", "4:2:0");
TiffWriteDefines writeDefines = new()
{
JpegTablesMode = TiffJpegTablesMode.None,
PreserveCompression = true,
RowsPerStrip = image.Height
};
image.Write("Test.tif", writeDefines);
The text was updated successfully, but these errors were encountered:
I do think this should be possible because I can see we use jpeg:sampling-factor in both the reader and writer. There might be a bug in the ImageMagick code but I will need to take some time to investigate that.
Magick.NET version
Magick.NET-Q16-x64 (13.5.0)
Environment (Operating system, version and so on)
Windows 11 / .Net 8 / VS2022
Description
I am creating a 1 page JPEG encoded TIFF image. I would like to be able to set the sampling factor for the page but no matter what I try (see console app below) the value of the YCbCr Subsampling tag always defaults to 1, 1 in the image.
Steps to Reproduce
This is a simple example to reproduce the issue and demonstrate the steps I have taken. (I am using proper images in my development code).
The text was updated successfully, but these errors were encountered: