Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. GDI Issue

GDI Issue

Scheduled Pinned Locked Moved C#
helpgraphicsdatabasemysqldata-structures
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gavin Jeffrey
    wrote on last edited by
    #1

    Hi, I have a strange problem (also difficult to explain but here goes) - basically I have a program that scans a email account (which receives faxes as tiff images as attatchments) when the program finds a new email it gets the tif saves it to a mySql database and also saves each individual image to the database. But sometimes one of the seperate images is corrupt i.e. I can see it in the database (blob editor - image) but i cant work with it at all - I can save it using mySql front but if i try and open the image it says drawing failed. If I try and use it in my code - byte[] MyData = (byte[])dataread["fileData"]; System.IO.MemoryStream mem = new System.IO.MemoryStream(MyData); mem.Flush(); System.Drawing.Image i = System.Drawing.Image.FromStream(mem); i.Save(mem,System.Drawing.Imaging.ImageFormat.Gif); it will give a gdi exception(a generic exception has occured) when i try create a image from the memoryStream another strange thing is that whenever I get an image like this the length of the byte array is always 74240. Also when I view the image in the tiff I can see no problems with it. Any ideas/help would be greatly appreciated. Thanks. Gavirj

    G 1 Reply Last reply
    0
    • G Gavin Jeffrey

      Hi, I have a strange problem (also difficult to explain but here goes) - basically I have a program that scans a email account (which receives faxes as tiff images as attatchments) when the program finds a new email it gets the tif saves it to a mySql database and also saves each individual image to the database. But sometimes one of the seperate images is corrupt i.e. I can see it in the database (blob editor - image) but i cant work with it at all - I can save it using mySql front but if i try and open the image it says drawing failed. If I try and use it in my code - byte[] MyData = (byte[])dataread["fileData"]; System.IO.MemoryStream mem = new System.IO.MemoryStream(MyData); mem.Flush(); System.Drawing.Image i = System.Drawing.Image.FromStream(mem); i.Save(mem,System.Drawing.Imaging.ImageFormat.Gif); it will give a gdi exception(a generic exception has occured) when i try create a image from the memoryStream another strange thing is that whenever I get an image like this the length of the byte array is always 74240. Also when I view the image in the tiff I can see no problems with it. Any ideas/help would be greatly appreciated. Thanks. Gavirj

      G Offline
      G Offline
      Gavin Jeffrey
      wrote on last edited by
      #2

      Anybody??

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups