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. How to retrieve a graphics object from an image object????

How to retrieve a graphics object from an image object????

Scheduled Pinned Locked Moved C#
graphicscsharpcsshelptutorial
3 Posts 2 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
    mmxguy
    wrote on last edited by
    #1

    I'am trying to retrieve a graphics object from an image object using the piece of code given below Graphics GDC = Graphics.Getimage(objImage) But it is throwing the exception...graphics cannot b retrieved from an image having INDEXED PIXEL FORMAT.Cud u tell me the reason y??? Nature of my work: I'am trying 2 draw some shapes on 2 an image in a picturebox control.After drawing the image i need 2 rotate the image.While rotating i need my drawings also 2 b rotated. I have tried it with all sort of transformations and then also itz not working.So i thought of retrieving the graphics object from the image and draw the shape(rectangle) using that so that while i'am rotating the image the drawing is also rotated. Pleez help me as i'm less xperienced in C# Regards, MMX

    W 1 Reply Last reply
    0
    • M mmxguy

      I'am trying to retrieve a graphics object from an image object using the piece of code given below Graphics GDC = Graphics.Getimage(objImage) But it is throwing the exception...graphics cannot b retrieved from an image having INDEXED PIXEL FORMAT.Cud u tell me the reason y??? Nature of my work: I'am trying 2 draw some shapes on 2 an image in a picturebox control.After drawing the image i need 2 rotate the image.While rotating i need my drawings also 2 b rotated. I have tried it with all sort of transformations and then also itz not working.So i thought of retrieving the graphics object from the image and draw the shape(rectangle) using that so that while i'am rotating the image the drawing is also rotated. Pleez help me as i'm less xperienced in C# Regards, MMX

      W Offline
      W Offline
      wibblewibblewibble
      wrote on last edited by
      #2

      I think you mean the Graphics.FromImage() method. The exception is thrown because your image contains an indexed pixel format, which is unsupported.

      M 1 Reply Last reply
      0
      • W wibblewibblewibble

        I think you mean the Graphics.FromImage() method. The exception is thrown because your image contains an indexed pixel format, which is unsupported.

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

        Then how do u retrieve the graphics handle of an image object which is having an indexed pixel format!!!! Regards, Mmx

        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