More explicit...
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.
[quoted text, click to view] "aggc" wrote:
> I had some problems with multi-page tiff files..
> .net uses GDI+ to manipulate Images and recently i discover (with help of
> others) that GDI+ doesn't support TIFF files with jpeg compression. Maybe 4th
> page it's an TIFF file with jpeg compression..
> When you invoke System.Drawing... FromFile and GDI+ doesn't support your
> format then raises an expection 'System.OutOfMemoryException: Out of memory'
>
> When you use System.Drawing... fromstream raise another exception 'Misses ...'
>
>
>
>
> "Chris Ashley" wrote:
>
> > I need to do some manipulation of Tif images, however I'm encountering
> > problems with multi-page Tif files.
> >
> > If there are three or less pages in the Tif, everything seems to work
> > fine. However once the Tif goes above this I get a
> > 'System.OutOfMemoryException: Out of memory.' - this is strange because
> > I can load a 10mb three-page Tif fine, but a 1mb four-page Tif won't
> > load so it can't be memory.
> >
> > Is there a problem with the .NET support for Tif images?
> >