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. save image after setting transparency

save image after setting transparency

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestion
3 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.
  • T Offline
    T Offline
    tagopi
    wrote on last edited by
    #1

    Hello I am loading an image file using gdiplus Bitmap class, and changing the transparency using ColorMatrix, and draw the image in device context, its showing fine in transparency. now i want to save this file in disk (with transparency). is there anyway to do that? i am doing like this. Bitmap gbmp = Bitmap::FromFile("C:\\anyimage.bmp"); ImageAttributes imgAttr; ColorMatrix tcm = { 1.0f, 0.0f, 0.0f, 0, 0, 0.0f, 1.0f, 0.0f, 0, 0, 0.0f, 0.0f, 1.0f, 0, 0, 0.0f, 0.0f, 0.0f, 0.6f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; imgAttr.SetColorMatrix(&cm, Gdiplus::ColorMatrixFlagsDefault,Gdiplus::ColorAdjustTypeBitmap); Graphics g(dc.GetSafeHdc()); g.DrawImage(gbmp, Gdiplus::Rect(0, 0, gbmp.GetWidth(), gbmp.GetHeight()), 0, 0, gbmp.GetWidth(), gbmp.GetHeight(),UnitPixel, &imgAttr); after this, i need to save this image in disk. Thanks A. Gopinath.

    A 1 Reply Last reply
    0
    • T tagopi

      Hello I am loading an image file using gdiplus Bitmap class, and changing the transparency using ColorMatrix, and draw the image in device context, its showing fine in transparency. now i want to save this file in disk (with transparency). is there anyway to do that? i am doing like this. Bitmap gbmp = Bitmap::FromFile("C:\\anyimage.bmp"); ImageAttributes imgAttr; ColorMatrix tcm = { 1.0f, 0.0f, 0.0f, 0, 0, 0.0f, 1.0f, 0.0f, 0, 0, 0.0f, 0.0f, 1.0f, 0, 0, 0.0f, 0.0f, 0.0f, 0.6f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; imgAttr.SetColorMatrix(&cm, Gdiplus::ColorMatrixFlagsDefault,Gdiplus::ColorAdjustTypeBitmap); Graphics g(dc.GetSafeHdc()); g.DrawImage(gbmp, Gdiplus::Rect(0, 0, gbmp.GetWidth(), gbmp.GetHeight()), 0, 0, gbmp.GetWidth(), gbmp.GetHeight(),UnitPixel, &imgAttr); after this, i need to save this image in disk. Thanks A. Gopinath.

      A Offline
      A Offline
      Alain Rist
      wrote on last edited by
      #2

      Hi, See Gdiplus::Image::Save() sample here[^]. cheers, AR

      When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

      M 1 Reply Last reply
      0
      • A Alain Rist

        Hi, See Gdiplus::Image::Save() sample here[^]. cheers, AR

        When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

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

        nice: but the doing man builds his own moon. and the wise man learns how others change the world (by me).

        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