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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how merge 2 PNG images in one

how merge 2 PNG images in one

Scheduled Pinned Locked Moved C#
questionperformancehelp
6 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    i need to merge two PNG images (loaded in memory) into one without lose the transparence of both (if there are some transparent area inside the first one or the second one or of both that are not mask by the other let it ). How can i do it? Then i need to get the final PNG file in memory and put it on a picturebox. It is really important, please help me if you. Thanks.

    N I 2 Replies Last reply
    0
    • A Anonymous

      i need to merge two PNG images (loaded in memory) into one without lose the transparence of both (if there are some transparent area inside the first one or the second one or of both that are not mask by the other let it ). How can i do it? Then i need to get the final PNG file in memory and put it on a picturebox. It is really important, please help me if you. Thanks.

      N Offline
      N Offline
      Niklas Ulvinge
      wrote on last edited by
      #2

      Compare each pixel and make an OR operation. The PROgrammer Niklas Ulvinge aka IDK

      1 Reply Last reply
      0
      • A Anonymous

        i need to merge two PNG images (loaded in memory) into one without lose the transparence of both (if there are some transparent area inside the first one or the second one or of both that are not mask by the other let it ). How can i do it? Then i need to get the final PNG file in memory and put it on a picturebox. It is really important, please help me if you. Thanks.

        I Offline
        I Offline
        iliyang
        wrote on last edited by
        #3

        Well, here's what you can do: 1) create a new Image object (with the appropriate size) 2) get a Graphics object for it (Graphics.FromImage static method) 3) draw the first image on the new image (using the Graphics object) 4) draw the secons image on the new image 5) now you have an Image object that meets the requirements Or, if you don't need one of the images, draw the other one over it. Cheers ;)

        A 1 Reply Last reply
        0
        • I iliyang

          Well, here's what you can do: 1) create a new Image object (with the appropriate size) 2) get a Graphics object for it (Graphics.FromImage static method) 3) draw the first image on the new image (using the Graphics object) 4) draw the secons image on the new image 5) now you have an Image object that meets the requirements Or, if you don't need one of the images, draw the other one over it. Cheers ;)

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          3) draw the first image on the new image (using the Graphics object) 4) draw the secons image on the new image 5) now you have an Image object that meets the requirements 3) what method do i need to use? 4) what other now so to don't overwrite the whole first image?

          I 1 Reply Last reply
          0
          • A Anonymous

            3) draw the first image on the new image (using the Graphics object) 4) draw the secons image on the new image 5) now you have an Image object that meets the requirements 3) what method do i need to use? 4) what other now so to don't overwrite the whole first image?

            I Offline
            I Offline
            iliyang
            wrote on last edited by
            #5
            1. use the DrawImage method of the Graphics class 4) you don't need to do anything else special. If the image that you'll draw over the first one is transperant, GDI+ will draw it correctly with alpha blending. Don't worry, just try it. I have and it works just fine ;)
            A 1 Reply Last reply
            0
            • I iliyang
              1. use the DrawImage method of the Graphics class 4) you don't need to do anything else special. If the image that you'll draw over the first one is transperant, GDI+ will draw it correctly with alpha blending. Don't worry, just try it. I have and it works just fine ;)
              A Offline
              A Offline
              Anonymous
              wrote on last edited by
              #6

              ok really thanks now the last thing: To create the right Image object to hanlde png 32 bit image how declaration syntax i have to use. Stop, tnx! :)

              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