1 Reply Latest reply on May 14, 2008 4:27 AM by kindaian

    Image Handling

    kindaian
      I've an image, filled with white and with some areas with a solid color which varies.

      1. How can i transform one of the colors at my choosing to black and all the others to white (to use it as a mask)?

      2. Having 2 diferent images, how do i use the mask to "copy" the black pixels in the mask, from image 2 to image 1?

      Tryed to "grok" the excelent article http://director-online.com/buildArticle.php?id=1029 but somewhere in between... i lost track (specially because i don't want any "effect", but just a blend of the images based on a mask build with one color).

      Thanx in advance,
        • 1. Image Handling
          kindaian Level 1
          Okie... after consulting the web and this forums the aswers are:

          1. http://director-online.com/buildArticle.php?id=1127

          Use of a derivative of this to create the masks of all the images that are masks with it's color notation. I opted to use the name of the mask as (original_name) & hexstring(color).

          2. Daniel Nelson's example with the smartAlphaCopyPixels gave me hints on how to do it:

          img1 = member("bitmap1").image.duplicate()
          img2 = member("bitmap2").image.duplicate()
          img1.useAlpha = TRUE
          img2.useAlpha = TRUE

          imask = img2.extractalpha()
          img2.usealpha = false

          img1.copyPixels(img2, img1.rect, img2.rect, [#ink:#mask, #maskimage:imask])
          member("composite").image = img1.duplicate()

          The roadblock that i was using was hitting was basicly the assignments of the correct use the alpha flags, coupled with the mask use. To create the mask i used the image.createMask() method.

          Thank you everyone for the help and insights

          ;)