PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Out Of Memory exception on Image.FromFile() - GDI+
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3086
Page 1 of 1

Author:  zoranm80 [ Tue Apr 07, 2015 10:07 am ]
Post subject:  Out Of Memory exception on Image.FromFile() - GDI+

Hi everybody,

I'm trying to display an image in tiff format (47,7kb). It's an image tiff CMYK + alpha chanel.

I'm using a GDI+ Build and the metod Image.FromFile() keeps on throwing "out of memory exception".

Do you have any solution?

My operating system is Windows 7 Service pack 1 and I'm using Visual Studio 2010.

Attached to this post there is the image tiff that I use.

Edit:
In MSDN Microsoft I read that "If the file does not have a valid image format or if GDI+ does not support the pixel format of the file, this method throws an OutOfMemoryException exception." and "The Image class does not support alpha transparency in bitmaps. To enable alpha transparency, use PNG images with 32 bits per pixel." https://msdn.microsoft.com/en-us/library/stf701f5(v=vs.110).aspx

But I must necessarily to display an image in tiff format with alpha transparency.

Thanks!

Attachments:
File comment: This is file tiff
cmyka.tif
cmyka.tif [ 47.71 KiB | Viewed 5855 times ]

Author:  Thomas Hoevel [ Tue Apr 07, 2015 10:50 am ]
Post subject:  Re: Out Of Memory exception on Image.FromFile() - GDI+

Hi!
zoranm80 wrote:
But I must necessarily to display an image in tiff format with alpha transparency.
The current implementation of PDFsharp relies on .NET to read the image file.

You can try the WPF build.

RGB tiff files with alpha transparency work. Is RGB an option?

Author:  zoranm80 [ Tue Apr 07, 2015 1:05 pm ]
Post subject:  Re: Out Of Memory exception on Image.FromFile() - GDI+

Hi Thomas,

I try use to WPF build but in GDI+ build there is a method that display CMYK image with transparency?

I only have a CMYK image with transparency that I can't convert to other formats.

Thanks for reply.

Edit:
I use also a method Bitmap() as this sample:

base.image = new Bitmap(value);

where "value" is a path of image and his type is a string.

but keeps on throwing exception "Parameter not valid".

Danilo

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/