Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Drawing / March 2006

Tip: Looking for answers? Try searching our database.

GDI+ saved images

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Curtis - 27 Mar 2006 17:13 GMT
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
black shows as white and the white shows as black. Anyone have any idea why
this would occur?

Thanks,
Curtis
Curtis - 27 Mar 2006 20:08 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.