Tiff Tag 254 NewSubfileType ALWAYS set to 2 when saving image

Discussions about image processing and document imaging.
Post Reply
mariocatch
Posts: 1
Joined: Wed Jun 21, 2023 9:01 pm

Tiff Tag 254 NewSubfileType ALWAYS set to 2 when saving image

Post by mariocatch » Wed Jun 21, 2023 9:15 pm

No matter what I do, when I save a gdpicture image to a tiff file, it sets the tag NewSubfileType to 2.
If I edit the tag using gdpicture and then save it, it is still showing it as a value of 2.

Code: Select all

oGdPictureImaging.TiffOpenMultiPageForWrite(false);

gdImageID = oGdPictureImaging.CreateGdPictureImageFromByteArray(inBytes); // byte[]

// shows NewSubfileType of 0
for (int i = 0; i < oGdPictureImaging.TagCount(gdImageID); i++)
{
    Console.WriteLine($"gdImageID after set ----{oGdPictureImaging.TagGetName(gdImageID, i)} - {oGdPictureImaging.TagGetValueString(gdImageID, i)}");
}

// remove tag
var status = oGdPictureImaging.TagSetValueBytes(gdImageID,
                                                Tags.TagNewSubfileType,
                                                TagType.TagTypeLong,
                                                new byte[] { 0 });

// NewSubfileType removed, not shown in list anymore
for (int i = 0; i < oGdPictureImaging.TagCount(gdImageID); i++)
{
    Console.WriteLine($"gdImageID after set 2 ----{oGdPictureImaging.TagGetName(gdImageID, i)} - {oGdPictureImaging.TagGetValueString(gdImageID, i)}");
}

// save bytes to file
oGdPictureImaging.SaveAsTIFF(gdImageID, "test.tiff", TiffCompression.TiffCompressionCCITT4);

// load file into new gdpicture image
var img1 = oGdPictureImaging.CreateGdPictureImageFromFile("test.tiff");

// shows NewSubfileType of 2
for (int i = 0; i < oGdPictureImaging.TagCount(img1); i++)
{
    Console.WriteLine($"gdImageID after set 1 ----{oGdPictureImaging.TagGetName(img1, i)} - {oGdPictureImaging.TagGetValueString(img1, i)}");
}


Hugo
Posts: 227
Joined: Tue Dec 18, 2018 10:09 am

Re: Tiff Tag 254 NewSubfileType ALWAYS set to 2 when saving image

Post by Hugo » Wed Jun 28, 2023 4:56 pm

Hi Mariocatch,

Thanks for your forum post here.

As you have created a ticket let's handle it there. You also mention using GdPicture V10 which could very well be the reason this issue is still a problem for you.
We can discuss potential solutions to try to get around this for you in your ticket if we can, despite using a much older version.

Regards,
Hugo Cudd
Technical Support

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest