Page 1 of 1

[VB.NET/C#] Convert Multipage TIFF to Multipage JBIG2

Posted: Sat Jan 15, 2011 3:29 pm
by Loïc
Hi,

Here a quick way to convert multipage TIFF image to a multipage JBIG2 image with GdPicture SDK (including the latest V10 major release).

Using VB.NET

Code: Select all

Dim oGdPictureImaging As New GdPictureImaging

Dim TiffID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\multipage.tif")
Dim Jbig2ID As Integer = 0
For i As Integer = 1 To oGdPictureImaging.TiffGetPageCount(TiffID)
	If i = 1 Then
		Jbig2ID = oGdPictureImaging.CreateClonedGdPictureImageI(TiffID)
		oGdPictureImaging.JBIG2SaveAsMultiPageFile(Jbig2ID, "c:\multipage.jb2")
	Else
		oGdPictureImaging.TiffSelectPage(TiffID, i)
		oGdPictureImaging.JBIG2AddToMultiPageFile(Jbig2ID, TiffID)
	End If
Next
oGdPictureImaging.JBIG2CloseMultiPageFile(Jbig2ID)
oGdPictureImaging.ReleaseGdPictureImage(TiffID)
oGdPictureImaging.ReleaseGdPictureImage(Jbig2ID)

MessageBox.Show("done")
Or using C#

Code: Select all

GdPictureImaging oGdPictureImaging = new GdPictureImaging();

int TiffID = oGdPictureImaging.CreateGdPictureImageFromFile("c:\\multipage.tif");
int Jbig2ID = 0;
for (int i = 1; i <= oGdPictureImaging.TiffGetPageCount(TiffID); i++) {
	if (i == 1) {
		Jbig2ID = oGdPictureImaging.CreateClonedGdPictureImageI(TiffID);
		oGdPictureImaging.JBIG2SaveAsMultiPageFile(Jbig2ID, "c:\\multipage.jb2");
	} else {
		oGdPictureImaging.TiffSelectPage(TiffID, i);
		oGdPictureImaging.JBIG2AddToMultiPageFile(Jbig2ID, TiffID);
	}
}
oGdPictureImaging.JBIG2CloseMultiPageFile(Jbig2ID);
oGdPictureImaging.ReleaseGdPictureImage(TiffID);
oGdPictureImaging.ReleaseGdPictureImage(Jbig2ID);

MessageBox.Show("done");

Re: [VB.NET/C#] Convert Multipage TIFF to Multipage JBIG2

Posted: Mon Apr 01, 2019 10:58 am
by Gabriela
Find the updated example here and many others in the Reference Guide.
Converting a multipage TIFF file to a multipage JBIG2 file

Re: [VB.NET/C#] Convert Multipage TIFF to Multipage JBIG2

Posted: Thu Apr 11, 2019 10:55 am
by rashirane
Excellent thread! Thanks for such a piece of excellent information. I like this site. Thank you again for this excellent information.