Re: Tiff or Tif with Jpeg Compression problem
- From: Joergen Bech <jbech<NOSPAM>@<NOSPAM>post1.tele.dk>
- Date: Wed, 25 Oct 2006 16:00:17 +0200
The error occurs in the System.Drawing.Bitmap(String fileName)
constructor - or more exactly - this constructor's internal call to
Gdip.GdipCreateBitmapFromFile, I suppose.
Take a look at the System.Drawing.Imaging.EncoderValue
enumeration where - among others - you will find the following
values:
- CompressionCCITT3 = 3
- CompressionCCITT4 = 4
- CompressionLZW = 2
- CompressionNone = 6
- CompressionRle = 5
No jpeg. It is fair to assume that if the framework does not
support saving to a specific format, you should not expect it
to read it either.
You probably need to get an image library.
Though I cannot fathom why anyone would want to use
jpeg-compressed tiff files in the first place, but that is besides
the point.
/JB
On Wed, 25 Oct 2006 03:13:02 -0700, aggc
<aggc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi everyone,
I'm using .net framework 1.1 and i'm doing an application that manipulate
tiff images.
Almost everything works fine.. But when Tiff images with jpeg or ojpeg
compression appears, System.Drawing.Image raises an exception.
I've tried many ways to work around the problem.. but it wasn't possible.
Dim objImage As System.Drawing.Image
' FileStream
Dim fs1 As New FileStream("c:\newtest.tif", FileMode.Open, FileAccess.Read)
System.Drawing.Image.FromStream(fs1, True, False)
'Exception -> misses ojpeg tags compression
'MemoryStream
Dim fs1 As New FileStream("c:\test.jpg", FileMode.Open)
Dim r1 As New IO.BinaryReader(fs1)
Dim buffer(fs1.Length) As Byte
r1.Read(buffer, 0, fs1.Length)
r1.Close()
fs1.Close()
Dim ms As New MemoryStream(buffer)
ms.Flush()
objImage = System.Drawing.Image.FromStream(ms)
'Exception -> misses ojpeg tags compression
'FromFile
objImage = System.Drawing.Image.FromFile("c:\newtest.tif")
'Exception -> out of memory
System.Drawing.Bitmap doesn't work either.
So, is there another way to solve that problem or it is some .net framework
limitation?
Thanks in advance,
André
.
- Follow-Ups:
- Re: Tiff or Tif with Jpeg Compression problem
- From: Joergen Bech
- Re: Tiff or Tif with Jpeg Compression problem
- Prev by Date: Re: Is there a good way to extract an object from a background?
- Next by Date: Re: Tiff or Tif with Jpeg Compression problem
- Previous by thread: Is there a good way to extract an object from a background?
- Next by thread: Re: Tiff or Tif with Jpeg Compression problem
- Index(es):
Relevant Pages
|