Extracting Frames From a TIF Compression Issue - 01/05/2018 13:05 EDT
$10-30 USD
Ακυρώθηκε
Αναρτήθηκε περίπου 6 χρόνια πριν
$10-30 USD
Πληρωμή κατά την παράδοση
I have the following function that is creating multipage tif files from a larger image. I need the Images to be Compression-CCITT4 images rather than the LZW this is creating.
Public Sub ExtractTiffFrames(ByVal start As Integer, ByVal endX As Integer, ByVal inputFileName As String, ByVal outputFileName As String)
Try
Dim MasterBitmap As Bitmap = New Bitmap(inputFileName)
'Start page of document(master)
Dim imageAdd As Image = [login to view URL](inputFileName)
'Frame Image that will be added to the master
Dim guid As Guid = [login to view URL](0)
'GUID
Dim dimension As FrameDimension = New FrameDimension(guid)
' start index cannot be less than 0 and cannot be greater than frame count
If ((start < 1) _
OrElse (endX > [login to view URL](dimension))) Then
Return
End If
Dim ep As EncoderParameters = New EncoderParameters(1)
'Get Image Codec Information
Dim codecs() As ImageCodecInfo = [login to view URL]
Dim codecInfo As ImageCodecInfo = codecs(3)
'image/tiff
'MultiFrame Encoding format
Dim epMultiFrame As EncoderParameter = New EncoderParameter([login to view URL], CType([login to view URL], Long))
[login to view URL](0) = epMultiFrame
[login to view URL](dimension, (start - 1))
[login to view URL](outputFileName, codecInfo, ep)
'create master document
'FrameDimensionPage Encoding format
Dim epFrameDimensionPage As EncoderParameter = New EncoderParameter([login to view URL], CType([login to view URL], Long))
[login to view URL](0) = epFrameDimensionPage
Dim i As Integer = start
Do While (i < endX)
[login to view URL](dimension, i)
'select next frame
[login to view URL](New Bitmap(imageAdd), ep)
'add it to the master
i = (i + 1)
Loop
'Flush Encoding format
Dim epFlush As EncoderParameter = New EncoderParameter([login to view URL], CType([login to view URL], Long))
[login to view URL](0) = epFlush
[login to view URL](ep)
'flush the file
Catch ex As Exception
Throw ex
End Try
End Sub