I have tested your code in vb.net but i found out that it still takes 43 seconds to convert a color tiff (LZW) to a B/W tiff (CCITTG4), with the inclusion of the split into 6 single pages which are then added to 1 multipage tiff. I use the CropCommand tool in combination with a rectangle to fetch the necessary piece (A4 format -- default height = 3508). Can you please give me some more advice on how i can completely do this run under 10 seconds ? Currently we are using the Peernet driver which can do this same job in 6-8 seconds, but it can only be run from an application and not from within a service ...
Below you can find the code which i use to do the split ...
Dim myNewRasterImage As RasterImage = codecs.Load(outputFile)
Dim myOriRasterImage As RasterImage = myNewRasterImage.CloneAll
heightOriginalDoc = myNewRasterImage.ImageHeight
currWidth = myNewRasterImage.ImageWidth
currYPos = 0
currPageNr = 1
currHeight = defaultHeight
Do While Not (heightOriginalDoc <= defaultHeight)
rc = New Rectangle(currXPos, currYPos, currWidth, currHeight)
currYPos = currYPos + currHeight
CropCommand.Rectangle = rc
CropCommand.Run(myNewRasterImage)
codecs.Save(myNewRasterImage, outputMultipage, RasterImageFormat.CcittGroup4, 1, 1, 1, 1, CodecsSavePageMode.Append)
heightOriginalDoc = heightOriginalDoc - currHeight
If heightOriginalDoc <= defaultHeight Then
rc = New Rectangle(currXPos, currYPos, currWidth, heightOriginalDoc)
CropCommand.Rectangle = rc
CropCommand.Run(myOriRasterImage)
Dim destImage As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, defaultWidth, defaultHeight, myOriRasterImage.BitsPerPixel, myOriRasterImage.Order, myOriRasterImage.ViewPerspective, myOriRasterImage.GetPalette(), IntPtr.Zero, 0)
Dim myCombineCommand As CombineFastCommand = New CombineFastCommand
myCombineCommand.DestinationRectangle = New Rectangle(0, 100, destImage.ImageWidth, destImage.ImageHeight)
myCombineCommand.SourcePoint = Point.Empty
myCombineCommand.DestinationImage = destImage
myCombineCommand.Flags = CombineFastCommandFlags.OperationAdd Or CombineFastCommandFlags.Destination0
myCombineCommand.Run(myOriRasterImage)
codecs.Save(destImage, outputMultipage, RasterImageFormat.CcittGroup4, 1, 1, 1, 1, CodecsSavePageMode.Append)
destImage.Dispose()
currPageNr = currPageNr + 1
Exit Do
End If
currPageNr = currPageNr + 1
myNewRasterImage = myOriRasterImage.CloneAll
Loop
Thanks in advance,
Wim