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. changing image format

changing image format

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

    Hi there I've encountered a small problemo...... I'm trying to change brightness of an image...so far so good. However I managed to make it work on 24-bit format images. When the filter is fed with an image which is either 8bit indexed or 32-bit formats...it fails! ...is there any way to access 8-bit indexed images with C# pointers! I was observing this message board and found out the following 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(); ...Many thanks to Andy Kirillov Does the above code...'store' my image as a 24 bit image? The code project....a perfect experience :cool: -- modified at 8:39 Saturday 22nd October, 2005

    A 1 Reply Last reply
    0
    • X XeoN Kc

      Hi there I've encountered a small problemo...... I'm trying to change brightness of an image...so far so good. However I managed to make it work on 24-bit format images. When the filter is fed with an image which is either 8bit indexed or 32-bit formats...it fails! ...is there any way to access 8-bit indexed images with C# pointers! I was observing this message board and found out the following 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(); ...Many thanks to Andy Kirillov Does the above code...'store' my image as a 24 bit image? The code project....a perfect experience :cool: -- modified at 8:39 Saturday 22nd October, 2005

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

      Hello Yes, you can use the above code to convert your image to 24bpp or 32bpp format (as you already know, Image.Clone does not produce this functionality, as it was expected). With 24bpp image you can use most of image processing filters.

      XeoN-Kc wrote:

      I was observing this message board and found out the following code:

      Yes, there is. Use LockBits. But, you will get troubles if you have color indexed image (like GIF). As you can see from my first article, I am using 24bpp format for color images, 8bpp indexed for grayscale images. Both formats I am processing using LockBits. And in the case of grayscale image it's rather obvious to implement brightness filter (the same logic as for 24bpp).

      XeoN-Kc wrote:

      ...Many thanks to Andy Kirillov

      Oh, what is it ? :~ Who changed my name ? :mad: With best regards, Andrew Kirillov, MCP x 3 Prize winner, August 2005

      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