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
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)
I must have been doing something stupid, my over thought out code was not working , your simple example did, grin.
easy fix thanks,
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.
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
Yes it is normal. Does this bring a problem ?
Not at all now that I know, thanks
Who is online
Users browsing this forum: No registered users and 7 guests