ruby-vips icon indicating copy to clipboard operation
ruby-vips copied to clipboard

Gray line on the edges in the multiply process

Open JohnAnon9771 opened this issue 1 year ago • 10 comments

Describe the bug When I try to perform a composite process with multiply, for some reason the overlay image gets a gray border. This is only happening with the multiply process. When checking with Photoshop, this issue does not occur, and the image appears without the border as it should from the beginning.

To Reproduce

def compose_images(art_image_path:, base_image_path:, x:, y:)
  base_image = Vips::Image.new_from_file(base_image_path)
  art_image = Vips::Image.new_from_file(art_image_path)
  
  base_image.composite(art_image, :multiply, x:, y:)
end

Resulting image:

testing4

Expected image:

composed_image20240715-2-oo8fl7

Additional context

To solve this problem, I applied a white background instead of transparent, but I'm not sure if this is the correct way to do it...

def compose_images(art_image_path:, base_image_path:, x:, y:)
  base_image = Vips::Image.new_from_file(base_image_path)
  art_image = Vips::Image.new_from_file(art_image_path)
  art_image = art_image.flatten(background: [255, 255, 255])
  
  base_image.composite(art_image, :multiply, x:, y:)
end

JohnAnon9771 avatar Jul 15 '24 18:07 JohnAnon9771