Fast Saving of Multi-page TIFF files (generally over 1000 pages)
When the SaveUseIFDOffset property is false (default), the image is appended to the end of the multi-page TIFF. Due to the linked format of TIFF, the software must traverse all the link pointers to identify the location to which the new page will be appended. The greater the number of pages in the target TIFF file, the longer the write process takes. (Typically, if the target file has more than 1000 pages, the write speed will degrade substantially.)
Setting the SaveUseIFDOffset property to true specifies that the control should write the image to the location stored in the SaveIFDOffset property. This enables much faster writing of TIFF files with many pages because the software can seek to that location without traversing all previous pointer links. This process gives very predictable speeds in adding pages to a multi-page TIFF file.
Important: If the file's IFDOffset ever became out of sync with the SaveIFDOffset property value, file corruption could occur. To protect the application from inadvertently corrupting a saved mutli-page file, the Twain PRO™ control takes the following measures:
- If the application sets the SaveUseIFDOffset property to true or false, the SaveIFDOffset property is automatically set to zero. The application must then explicitly set the IFD Offset to be used.
- Executing the SaveFile method will automatically set the SaveUseIFDOffset property to false. The application must then explicitly set the value back to true as needed.
- When the SaveIFDOffset property is zero, a normal write (not fast TIFF write) will occur regardless of the SaveUseIFDOffset value. The fast write will take place only when SaveIFDOffset is set to non-zero and the SaveUseIFDOffset is set to true.
VB Example | ![]() |
---|---|
' This code demonstrates how to use the SaveUseIFDOffset and SaveIFDOffset properties to safely enable fast TIFF writing Dim outputFile As String Dim myIfdOffset As Long Public Sub SaveMpTiffUsingIfd() tp.SaveMultiPage = True tp.SaveFileType = TP_SaveFileType_Tiff outputFile = App.Path & "\mpIfd.tif" Dim fso As New FileSystemObject If fso.FileExists(outputFile) Then Kill outputFile End If Set fso = Nothing tp.StartSession End Sub Private Sub tp_PostScan(Cancel As Boolean) tp.SaveUseIFDOffset = True tp.SaveIFDOffset = myIfdOffset tp.SaveFile outputFile myIfdOffset = tp.SaveIFDOffset End Sub |