0 Replies Latest reply on Jun 14, 2007 12:50 PM by axelmos2

    bad quality using copyPixels?

    axelmos2
      I have two images with transparent background and same size in a castLib and want to copy them into a new image. So for doing that I create a new image called “my_img” and copy the member "circle_yellow" and the member "circle_red" into it using copyPixels, then I create another new image callet "my_alpha" and copy only the alpha of each circle into it. I use this image to set the alpha of the image "my_img".


      IMAGE 1
      [img]http://img519.imageshack.us/img519/290/img1zi7.jpg[/img]

      IMAGE 2
      [img]http://img510.imageshack.us/img510/981/img2bi0.jpg[/img]

      This is the code I use:

      img1 = member("circle_yellow").image
      img2 = member("circle_red").image

      -- IMAGE
      my_img = image(400,400,32)
      my_img.copyPixels(img1, img1.rect, img1.rect)
      my_img.copyPixels(img2, img2.rect, img2.rect)

      -- ALPHA
      my_alpha = image(400,400,8, #grayscale)
      my_alpha.copyPixels(img1.extractalpha(), img1.rect, img1.rect, [#ink : 1])
      my_alpha.copyPixels(img2.extractalpha(), img2.rect, img2.rect, [#ink : 1])

      my_img.usealpha = 1
      my_img.setAlpha(my_alpha)

      member("final_image").image = my_img

      RESULT IMAGE:
      [img]http://img231.imageshack.us/img231/1520/resultpx9.jpg[/img]

      WITH ZOOM: (when the background has the same color of the image you can see the pixels in the borders)
      [img]http://img503.imageshack.us/img503/2194/zoom3jl3.jpg[/img]
      [img]http://img503.imageshack.us/img503/3133/zoom2hv3.jpg[/img]



      The result in member "final_image" is one image with transparent background that contains both circles. This is Ok, Works fine, but the problem is the quality. Both circles has white pixels in their borders and I need them to be perfect.

      Does anyone knows a a way to doing this with better quality?