Does any of the Aspose Products provide a solution for TIFF/White Color Channel

I need a tif/CMYK file. In the color channels it will have a C, M, Y, K and a White channel.

The first challenge I am facing is how to create this White channel. It should be named “White”. Is this possible to add a 5 channel and name it “White”?

The second challenge I am facing is to get the colors from C, M, Y and K channels all combined in this White channel. It will be colored to a single color: let it be red.

This white channel will then be interpreted by the printer to print the white color. On top of this white color, all other colors are printed.

Hello, @harry.ardimedia ,
Aspose.Imaging allows creating and exporting TIFF image with CMYKA color space with A for alpha (transparency).

public void ExportToTiffCmyka(string inputPath, string outputPath)
{
    using (var image = Image.Load(inputPath))
    {
        image.Save(outputPath, new TiffOptions(TiffExpectedFormat.TiffLzwCmyka));
    }
}

public void CreateTiffCmyka(int w, int h, string outputPath)
{
    var source = new FileCreateSource(outputPath, false);
    var options = new TiffOptions(TiffExpectedFormat.TiffLzwCmyka)
    {
        Source = source,
    };

    using (var image = Image.Create(options, w, h))
    {
        image.Save();
    }
}

Let us know if this resolves your request!

Thankx Denis.

I guess not.

Would it be possible to name this channel a certain name, e.g. White?

I am not fully aware of the A (alpha/transparency) channel, but if this is really just for transparency, then it is not what I am looking for. I am looking for a independent channel, which holds “all colors form cymk” combined, so that this channel can be used to print white on our production machine.

Thankx!

@harry.ardimedia, let me process your request to make up a solution. You will be answered shortly!

@harry.ardimedia , I have processed your request, so here is an approach of storing additional CMYK component.

As concerns giving a specific name to a channel, I have not found such a feature in TIFF specification.

For storing additional component info (CMYK + “White”), here is a workaround:

public static void ExportToTiffCmyk(string inputPath, string outputPath)
{
    using var image = Image.Load(inputPath) as RasterImage; // try loading an image with transpareny, for example a 32-bit PNG
    var pixels = image.LoadArgb32Pixels(image.Bounds); // loading image ARGB pixels, assume A for additional component (you called it "White" above), RGB for storing CMYK.

    const int RgbMask = 0x00ffffff;
    for (int i = 0; i < pixels.Length; i++)
    {
        var argb = pixels[i];

        var a = (byte)(argb >> 24);
        var r = (byte)(argb >> 16);
        var g = (byte)(argb >> 8);
        var b = (byte)argb;

        a = 127; // transforming additional chanel of ARGB pixel

        pixels[i] = (a << 24) | (argb & RgbMask); // storing component back to the pixel
    }

    image.SaveArgb32Pixels(image.Bounds, pixels); // saving the pixels to the image for futher export

    var options = new TiffOptions(TiffExpectedFormat.TiffLzwCmyka) // export options for TIFF CMYK with additional component
    {
        AlphaStorage = TiffAlphaStorage.Unspecified, // treats 5-th CMYK component as additional info rather than alpha
        // AlphaStorage = TiffAlphaStorage.Assosiated, // treats 5-th CMYK component as level of transparency or level of white, when printed
    };

    image.Save(outputPath, options);
}

Actually, it seems to me that the output you are trying to achieve is blending of CMYK with White, which can be actually treated as Alpha. I think if a printer supports TIFF processing, it would actually treat A component from CMYKA as level of white color for each pixel.

Try to test code example above whether it meets your requirements. Let us know if it helps!

Thank you so much, Denis.

I have tested your code and when opening the generated file in Photoshop I get the following message:

Beim Lesen der Metadaten der Datei ist ein Fehler aufgetreten. Dieses Dokument ist möglicherweise beschädigt (die Datei ist möglicherweise abgeschnitten oder unvollständig).

After this message the file is shown in Photoshop. When I check the Photoshop channel I see only Cyan, Magenta, Gelb and Schwarz, no Alpha channel.

@harry.ardimedia,
I would like to know if the code examples above actually output what you meant. Did you try to print the output using your machine? So we can figure out if it is a primary solution for now.
You could also share the sources, specification or requirements to TIFF file when printing on your machine.

As concerns the exception message from Photoshop, could you share the image file causing it? We need to reproduce the issue. It says there is a metadata error in TIFF file, so it really depends on specific file.

When the image is viewed by Photoshop, it really shows only CMYK channels without A. Photoshop pre-multiplies CMYK values with A on loading, if TiffOptions.AlphaStorage != TiffAlphaStorage.Unspecified.
Pre-multiplies means that for A = 0 we get C = M … = K = 0. As I far as I know White is CMYK = [0,0,0,0], but I am not into printing machine specifics.