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 / C++ / MFC
  4. Saving icon to PNG file (GDI+)?

Saving icon to PNG file (GDI+)?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicswinformstutorialquestion
5 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.
  • A Offline
    A Offline
    akirilov
    wrote on last edited by
    #1

    Hi guys, I'm trying to make a routine that save an icon (HICON) to png file with GDI+

    Bitmap* bmp = new Bitmap(icon);
    GetEncoderClsid(L"image/png", &encoderClsid);
    bmp->Save(L"xxx.png", &encoderClsid, NULL);

    So far so good. But when I open the png ... it is not transluctant (semi transparent). Any ideas why??? And I found that GDI+ has A LOT of problems with icons :( P.S. If you have another suggestion how to do this, please share fragment of code.

    L A 2 Replies Last reply
    0
    • A akirilov

      Hi guys, I'm trying to make a routine that save an icon (HICON) to png file with GDI+

      Bitmap* bmp = new Bitmap(icon);
      GetEncoderClsid(L"image/png", &encoderClsid);
      bmp->Save(L"xxx.png", &encoderClsid, NULL);

      So far so good. But when I open the png ... it is not transluctant (semi transparent). Any ideas why??? And I found that GDI+ has A LOT of problems with icons :( P.S. If you have another suggestion how to do this, please share fragment of code.

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

      I'm not sure that you can do this directly as you suggest. Icons are 'special' file types that Windows understands and paints in a slightly different manner to ordinary bitmaps. Take a look at Icons in MSDN for more information.

      1 Reply Last reply
      0
      • A akirilov

        Hi guys, I'm trying to make a routine that save an icon (HICON) to png file with GDI+

        Bitmap* bmp = new Bitmap(icon);
        GetEncoderClsid(L"image/png", &encoderClsid);
        bmp->Save(L"xxx.png", &encoderClsid, NULL);

        So far so good. But when I open the png ... it is not transluctant (semi transparent). Any ideas why??? And I found that GDI+ has A LOT of problems with icons :( P.S. If you have another suggestion how to do this, please share fragment of code.

        A Offline
        A Offline
        akirilov
        wrote on last edited by
        #3

        Is my question so hard? Nobody had similar experience? :((

        L 1 Reply Last reply
        0
        • A akirilov

          Is my question so hard? Nobody had similar experience? :((

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

          It has been answered many years ago on Google (Groups), Win32

          A 1 Reply Last reply
          0
          • L Lost User

            It has been answered many years ago on Google (Groups), Win32

            A Offline
            A Offline
            akirilov
            wrote on last edited by
            #5

            Could share direct link? I'm no a member of these groups?

            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