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. Visual Basic
  4. Generic Error In GDI+

Generic Error In GDI+

Scheduled Pinned Locked Moved Visual Basic
graphicshelpcsharpwinformsquestion
6 Posts 3 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.
  • M Offline
    M Offline
    MatrixCoder
    wrote on last edited by
    #1

    I am writing an image resizing program, but I every time I try to save an image I get an error saying "Generic Error In GDI+". I've tried running my app on 3 different computers (2 desktops and 1 laptop all with WinXP and .NET 2.0), and the error only occurs on the laptop. I've looked everywhere for someone with a similar problem, and either it's something irrelevant or no one got an answer. What's going on?

    Dim InitialImage As Bitmap = New Bitmap(OpenLocation)
    Dim SetImage As Bitmap
    SetImage = New Bitmap(InitialImage, New Size(WidthInt, HeightInt))
    SetImage.Save(PathName, System.Drawing.Imaging.ImageFormat.Jpeg)

    Thanks for the help!


    Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

    S 1 Reply Last reply
    0
    • M MatrixCoder

      I am writing an image resizing program, but I every time I try to save an image I get an error saying "Generic Error In GDI+". I've tried running my app on 3 different computers (2 desktops and 1 laptop all with WinXP and .NET 2.0), and the error only occurs on the laptop. I've looked everywhere for someone with a similar problem, and either it's something irrelevant or no one got an answer. What's going on?

      Dim InitialImage As Bitmap = New Bitmap(OpenLocation)
      Dim SetImage As Bitmap
      SetImage = New Bitmap(InitialImage, New Size(WidthInt, HeightInt))
      SetImage.Save(PathName, System.Drawing.Imaging.ImageFormat.Jpeg)

      Thanks for the help!


      Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      Apparently from ASP.Net you will get this error when you are using a file path as a string. If this does not solve your problem then look at security issues in the Laptop. The ASPNET useraccount may not have permissions to write to disk.

      Regards, Satips.

      M 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        Apparently from ASP.Net you will get this error when you are using a file path as a string. If this does not solve your problem then look at security issues in the Laptop. The ASPNET useraccount may not have permissions to write to disk.

        Regards, Satips.

        M Offline
        M Offline
        MatrixCoder
        wrote on last edited by
        #3

        Neither of these helped. The account on the laptop has write privileges. Any other ideas? Thanks.


        Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

        P 1 Reply Last reply
        0
        • M MatrixCoder

          Neither of these helped. The account on the laptop has write privileges. Any other ideas? Thanks.


          Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

          P Offline
          P Offline
          Polymorpher
          wrote on last edited by
          #4

          Yea, I ran into this problem too...this should help...save using the encoder...if it returns nothing...then you will need to use a default encoder...like for a bitmap or something. Private Shared Function FindImageEncoder(ByVal theImg As Image) As ImageCodecInfo For Each info As ImageCodecInfo In ImageCodecInfo.GetImageEncoders If info.FormatID.Equals(theImg.RawFormat.Guid) Then Return info Next info Return Nothing End Function

          Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so

          M 1 Reply Last reply
          0
          • P Polymorpher

            Yea, I ran into this problem too...this should help...save using the encoder...if it returns nothing...then you will need to use a default encoder...like for a bitmap or something. Private Shared Function FindImageEncoder(ByVal theImg As Image) As ImageCodecInfo For Each info As ImageCodecInfo In ImageCodecInfo.GetImageEncoders If info.FormatID.Equals(theImg.RawFormat.Guid) Then Return info Next info Return Nothing End Function

            Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so

            M Offline
            M Offline
            MatrixCoder
            wrote on last edited by
            #5

            Thanks a lot!


            Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

            P 1 Reply Last reply
            0
            • M MatrixCoder

              Thanks a lot!


              Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

              P Offline
              P Offline
              Polymorpher
              wrote on last edited by
              #6

              Any time, hope it helps, if not let me know.

              Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so

              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