3

I used this code for converting tiff to png before:

 using (MemoryStream inStream = new MemoryStream(tiffBytes))
 {
     using (MemoryStream outStream = new MemoryStream())
     {
         System.Drawing.Image.FromStream(inStream)
             .Save(outStream, System.Drawing.Imaging.ImageFormat.Png);
     }
 }

and it worked very well for all tiff files with any size and dimension until I needed to change this code and converting TIFF filse to JPEG:

using (MemoryStream inStream = new MemoryStream(tiffBytes))
 {
     using (MemoryStream outStream = new MemoryStream())
     {
         System.Drawing.Image.FromStream(inStream)
             .Save(outStream, System.Drawing.Imaging.ImageFormat.Jpeg);
     }
 }

But when I changed the code, I get a generic error for uploading big tiff size. like an image with 21 MB size. (there are no problems with little tiff size).

"A generic error occurred in GDI+."

What can I do? I have no limits on the size.

n.y
  • 3,343
  • 3
  • 35
  • 54
  • Possible duplicate of [convert tiff to jpg format](https://stackoverflow.com/questions/11668945/convert-tiff-to-jpg-format) – Sinatr Oct 04 '17 at 13:01
  • Lots of interesting answers here: [A generic error occurred in GDI+, JPEG Image to MemoryStream](https://stackoverflow.com/questions/1053052/a-generic-error-occurred-in-gdi-jpeg-image-to-memorystream) – Olivier Jacot-Descombes Oct 04 '17 at 13:03
  • The image dimensions may be the issue as there's a limit at 65534 pixels; https://stackoverflow.com/a/13646902/1838819 – DiskJunky Oct 04 '17 at 13:05

0 Answers0