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+ Problemo

GDI+ Problemo

Scheduled Pinned Locked Moved C#
graphicswinformshelpquestion
5 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.
  • X Offline
    X Offline
    XeoN Kc
    wrote on last edited by
    #1

    Hi guyz. I am trying to lock the bits of a gif image which is 32-bit. However, I am getting an invalid parameter on this code : BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format32BppArgb); where b is the bitmap variable in which I load the image in! Can any body help out on this? because I really have no idea now...since in 24-bit withPixelFormat24BppRgb(bmp + jpg) worked correctly! :confused: To Dare Is To Do :cool:

    L A 2 Replies Last reply
    0
    • X XeoN Kc

      Hi guyz. I am trying to lock the bits of a gif image which is 32-bit. However, I am getting an invalid parameter on this code : BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format32BppArgb); where b is the bitmap variable in which I load the image in! Can any body help out on this? because I really have no idea now...since in 24-bit withPixelFormat24BppRgb(bmp + jpg) worked correctly! :confused: To Dare Is To Do :cool:

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Try 8bitIndexed pixel format xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

      1 Reply Last reply
      0
      • X XeoN Kc

        Hi guyz. I am trying to lock the bits of a gif image which is 32-bit. However, I am getting an invalid parameter on this code : BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format32BppArgb); where b is the bitmap variable in which I load the image in! Can any body help out on this? because I really have no idea now...since in 24-bit withPixelFormat24BppRgb(bmp + jpg) worked correctly! :confused: To Dare Is To Do :cool:

        A Offline
        A Offline
        Andrew Kirillov
        wrote on last edited by
        #3

        Hello Why do you think your GIF image is 32-bit ? You can check the PixelFormat property and you will see, that it's Format8bppIndexed. You can try to use ImageLockMode.ReadOnly mode or lock your image with PixelFormat.Format8bppIndexed or convert your image to 32-bit before (which will be useful if you are planning some image processing routines). With best regards, Andrew

        X 1 Reply Last reply
        0
        • A Andrew Kirillov

          Hello Why do you think your GIF image is 32-bit ? You can check the PixelFormat property and you will see, that it's Format8bppIndexed. You can try to use ImageLockMode.ReadOnly mode or lock your image with PixelFormat.Format8bppIndexed or convert your image to 32-bit before (which will be useful if you are planning some image processing routines). With best regards, Andrew

          X Offline
          X Offline
          XeoN Kc
          wrote on last edited by
          #4

          Yep that's actually what I'm trying to do! To convert to 32-bit from 8 bit index....how?? bcos I really do not know! Thanks guys To Dare Is To Do

          A 1 Reply Last reply
          0
          • X XeoN Kc

            Yep that's actually what I'm trying to do! To convert to 32-bit from 8 bit index....how?? bcos I really do not know! Thanks guys To Dare Is To Do

            A Offline
            A Offline
            Andrew Kirillov
            wrote on last edited by
            #5

            Hello. You can use the next code:

            // create new image with desired pixel format
            Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            
            // draw source image on the new one using Graphics
            Graphics g = Graphics.FromImage(bmp);
            g.DrawImage(src, 0, 0, width, height);
            g.Dispose();
            

            With best regards, Andrew

            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