Re: Color problems when converting indexed8 to 24 bit
- From: Linus <lsilvand@xxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 09:32:27 -0700 (PDT)
Hi,
Here's the link to it: http://web.abo.fi/~lsilvand/SEM.tif
It's an uncompressed 6 Mb TIFF file. Dimensions:3072x2304. 8-bit
indexed. Search for white after you've loaded it in, there should be
plenty of it if everythings ok.
The problem is that I've got thousands of files just like this one and
I'ld hope that there's something wrong with the TIFF loader and not
with the program producing these TIFF images.
Could a problem with the TIFF image also explain why I get a black
image while copying it with DrawImage(image,point()). I always have to
use DrawImage(image,rectangle()) to get it to produce and ok image.
Regards,
Linus
On Mar 31, 6:28 pm, "Bob Powell [MVP]" <b...@xxxxxxxxxxxxxxxxxxxxxxx>
wrote:
You seem to have chosen the best mode for a simple copy.
Can you post the image that you want to make a copy of?
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consultinghttp://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Trickshttp://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQhttp://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Linus" <lsilv...@xxxxxxxxxxx> wrote in message
news:6a86a59e-d7bb-4657-95a9-82fe612266ce@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I'm having a problem converting an indexed8 tiff image to a 24bit
image. When I convert it with DrawImage or for example
DrawImageUnscaledAndClipped it drops the RGB with one. For example
(255,255,255) would become (254,254,254). I've tried the victor image
processing library demo version and with it I've no problems.
Photoshop also converts it to 24bit correctly. Now I'm asking, what
Graphics setting do I need to set to get it to convert the image
correctly? I've included part of the code below. Also, is it possible
to export a reference to a bitmap from a function? How do I dispose of
the bitmap in the function? Or shouldn't I do it? Will it be enough if
the caller disposes of it?
Thanks,
Linus
Function OpenImage(ByVal filename As String) As Bitmap
Dim image As Bitmap
Dim image24 As Bitmap
Dim g As Graphics
Try
image = New Bitmap(filename)
image24 = New Bitmap(image.Width, image.Height,
Imaging.PixelFormat.Format24bppRgb)
g = Graphics.FromImage(image24)
' g.CompositingMode =
Drawing2D.CompositingMode.SourceCopy
' g.CompositingQuality =
Drawing2D.CompositingQuality.AssumeLinear
' g.InterpolationMode =
Drawing2D.InterpolationMode.NearestNeighbor
' g.PixelOffsetMode = Drawing2D.PixelOffsetMode.Half
' g.PageUnit = GraphicsUnit.Pixel
' g.SmoothingMode = Drawing2D.SmoothingMode.None
g.DrawImage(image, 0, 0, image.Width, image.Height)
image24.Save(filename & "2.png")
Catch
image24 = Nothing
End Try
If Not (IsNothing(g)) Then g.Dispose()
If Not (IsNothing(image)) Then image.Dispose()
OpenImage = image24
'If Not (IsNothing(image24)) Then image24.Dispose()
End Function
.
- References:
- Color problems when converting indexed8 to 24 bit
- From: Linus
- Re: Color problems when converting indexed8 to 24 bit
- From: Bob Powell [MVP]
- Color problems when converting indexed8 to 24 bit
- Prev by Date: Re: Color problems when converting indexed8 to 24 bit
- Next by Date: Re: Color problems when converting indexed8 to 24 bit
- Previous by thread: Re: Color problems when converting indexed8 to 24 bit
- Next by thread: Re: Color problems when converting indexed8 to 24 bit
- Index(es):
Relevant Pages
|
Loading