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. Write image as Indexed PNG C#

Write image as Indexed PNG C#

Scheduled Pinned Locked Moved C#
csharpquestiongraphics
6 Posts 4 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.
  • S Offline
    S Offline
    Steve_
    wrote on last edited by
    #1

    Hi, I have an instance of Bitmap that I want to save as an PNG with Indexed colour mode. How can I do this in .NET? Thanks, Steve

    B L S 3 Replies Last reply
    0
    • S Steve_

      Hi, I have an instance of Bitmap that I want to save as an PNG with Indexed colour mode. How can I do this in .NET? Thanks, Steve

      B Offline
      B Offline
      buachaill cliste
      wrote on last edited by
      #2

      Don't know about indexed colour as I've never had the necessity to do it before and google might help ;) but this:

      Bitmap bmp = new Bitmap(x,y);
      bmp.Save("c:\\bmp", System.Drawing.Imaging.ImageFormat.Png);

      L 1 Reply Last reply
      0
      • B buachaill cliste

        Don't know about indexed colour as I've never had the necessity to do it before and google might help ;) but this:

        Bitmap bmp = new Bitmap(x,y);
        bmp.Save("c:\\bmp", System.Drawing.Imaging.ImageFormat.Png);

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        That always saves as ARGB png as far as I know..

        B 1 Reply Last reply
        0
        • L Lost User

          That always saves as ARGB png as far as I know..

          B Offline
          B Offline
          buachaill cliste
          wrote on last edited by
          #4

          Oh ok. I didn't know :-D Just tryin' to help :)

          1 Reply Last reply
          0
          • S Steve_

            Hi, I have an instance of Bitmap that I want to save as an PNG with Indexed colour mode. How can I do this in .NET? Thanks, Steve

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi, I don't think .NET supports indexed colors for PNG. This MSDN page[^] says PNG needs 0 bytes for parameters, so there is nothing to choose from. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in


            1 Reply Last reply
            0
            • S Steve_

              Hi, I have an instance of Bitmap that I want to save as an PNG with Indexed colour mode. How can I do this in .NET? Thanks, Steve

              S Offline
              S Offline
              Steve_
              wrote on last edited by
              #6

              For anyone else who wants to achieve this, the FreeImage project provides support for a large number of image codecs and colour modes and has bindings for C#. It is what I used to create a PNG8 file. Steve

              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