Tagging or marking individual pages in a CCITT4 tiff file

Discussions about image processing and document imaging.
Post Reply
sbarlow
Posts: 31
Joined: Fri Jun 19, 2009 3:13 pm

Tagging or marking individual pages in a CCITT4 tiff file

Post by sbarlow » Wed Jun 09, 2010 8:59 pm

Hi,

I've been trying to figure out a way to either modify a tag, add a new tag, to the individual image pages in a multipage tiff file, but I'm not having any luck. Doesn't even have to be a tag, just some way of recognizing the page as being modified, change width, height anything. Purpose is to rearrange pages by doing the following

1. Clone each page to be moved from the original file, store in a list (tiffselectpage,tiffgetcurrentpage,clone)
2. Mark the pages in the original file that were cloned
3. Insert the cloned images into the original file at some page number --- This works
4. Iterate all the pages and delete the ones that were marked

Any ideas? When iterating through the pages I get inconsistent results (sometimes it works, sometimes not) with either tagging, modifying a tag, resize etc.

thanks for any help

Scott

User avatar
Loïc
Site Admin
Posts: 5743
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Tagging or marking individual pages in a CCITT4 tiff file

Post by Loïc » Thu Jun 10, 2010 11:28 am

Hi,

I give you a code sample to write the SoftwareUsed tag on each page of a multipage tiff document.

Code: Select all

        Dim ImageID As Integer = Imaging1.TiffCreateMultiPageFromFile("c:\test.tif")

        For i As Integer = 1 To Imaging1.TiffGetPageCount(ImageID)
            Imaging1.TiffSelectPage(ImageID, i)
            Imaging1.TagSetValueString(ImageID, Tags.TagSoftwareUsed, TagType.TagTypeASCII, "GdPicture.NET")
        Next

        Imaging1.TiffSaveMultiPageToFile(ImageID, "c:\test.tif", TiffCompression.TiffCompressionCCITT4)
        Imaging1.ReleaseGdPictureImage(ImageID)
Let me know if you need more explanations.

Loïc

sbarlow
Posts: 31
Joined: Fri Jun 19, 2009 3:13 pm

Re: Tagging or marking individual pages in a CCITT4 tiff file

Post by sbarlow » Thu Jun 10, 2010 2:07 pm

Thanks Loïc,

I must have been doing something stupid, my over thought out code was not working , your simple example did, grin.

easy fix thanks,

Scott

User avatar
Loïc
Site Admin
Posts: 5743
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Tagging or marking individual pages in a CCITT4 tiff file

Post by Loïc » Thu Jun 10, 2010 2:13 pm

Hi Scott,

Thank you for the return. Feel free to report any error related to tags. We want to bring full & bug-free implementation for such purpose.

Kind regards,

Loïc

sbarlow
Posts: 31
Joined: Fri Jun 19, 2009 3:13 pm

Re: Tagging or marking individual pages in a CCITT4 tiff file

Post by sbarlow » Thu Jun 10, 2010 3:41 pm

HI Loïc,

I didn't realize that the GdPictureImaging.TagGetValueString returns a null terminated string, is this normal?

Code: Select all

Dim sval As String = GDP.TagGetValueString(ImageID, tagsI)
                        Dim ca() As Char = sval.ToCharArray
                        For Each c As Char In ca
                            Debug.Print(Asc(c).ToString)
                        Next
Will show ASCII code 0 at the end

Thanks,
Scott

User avatar
Loïc
Site Admin
Posts: 5743
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Tagging or marking individual pages in a CCITT4 tiff file

Post by Loïc » Thu Jun 10, 2010 3:46 pm

Hi Scott,

Yes it is normal. Does this bring a problem ?

Loïc

sbarlow
Posts: 31
Joined: Fri Jun 19, 2009 3:13 pm

Re: Tagging or marking individual pages in a CCITT4 tiff file

Post by sbarlow » Thu Jun 10, 2010 4:06 pm

HI Loïc,

Not at all now that I know, thanks

Scott

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest