Note: I am saving off TIF images and this is my code,
Dim enc As Encoder = Encoder.SaveFlag
Dim info As ImageCodecInfo = Nothing
Dim ice As ImageCodecInfo
Try
For Each ice In ImageCodecInfo.GetImageEncoders
If ice.MimeType = "image/tiff" Then
info = ice
End If
Next
Dim ep As New EncoderParameters(1)
ep.Param(0) = New EncoderParameter(enc,
CLng(EncoderValue.MultiFrame))
Dim tmpTif As Bitmap
Dim strSerial As String = Nothing
'Get the serial string from the array
strSerial = CStr(strImgs.Item(0))
Dim bmpPage1 As New Bitmap(imgSerial.Deserialize(strSerial,
True))
bmpPage1 = ImgConv.ConverttoFormatbpp1(bmpPage1)
bmpPage1.SetResolution(150, 150)
tmpTif = CType(bmpPage1, Bitmap)
Dim I As Integer
If strImgs.Count > 1 Then
'Save the first page
tmpTif.Save(destpath, info, ep)
For I = 1 To strImgs.Count - 1
strSerial = Nothing
strSerial = strImgs.Item(I)
Dim bmpPage As New
Bitmap(imgSerial.Deserialize(strSerial, True))
bmpPage = ImgConv.ConverttoFormatbpp1(bmpPage)
bmpPage.SetResolution(150, 150)
'Save the rest of the pages
'Reset for next page
ep.Param(0) = New EncoderParameter(enc,
CLng(EncoderValue.FrameDimensionPage))
tmpTif.SaveAdd(bmpPage, ep)
bmpPage = Nothing
Next
'Close out last tif and the last page
ep.Param(0) = New EncoderParameter(enc,
CLng(EncoderValue.Flush))
tmpTif.SaveAdd(ep)
tmpTif = Nothing
Else
'Just save as a single page tif
tmpTif.Save(destpath, info, ep)
'Close out last tif and the last page
ep.Param(0) = New EncoderParameter(enc,
CLng(EncoderValue.Flush))
tmpTif.SaveAdd(ep)
tmpTif = Nothing
bmpPage1 = Nothing
End If
Return True
Catch ex As Exception
mstrErrors = mstrErrors & ex.Message
Return False
End Try
End Function
I can view the images just fine when I use a .net applicatoin but when I try
to view them with Imagemagick they are inverted. Any help would be greatly
apperciated.
Thanks,
Curtis
>I am saving off 1 bit depth 150X150 dpi images and trying to view them with
>Imagemagick. The problem is some of the images are inverted meaning the
[quoted text clipped - 3 lines]
> Thanks,
> Curtis
Curtis - 27 Mar 2006 21:00 GMT
Problem solved I switched from using LZW compression to Group4 compression.
Seemed to fixed the problem.
> Note: I am saving off TIF images and this is my code,
>
[quoted text clipped - 73 lines]
>> Thanks,
>> Curtis