Reputation: 1705
I want to paste an image into a single coloured background using PIL but some blures and noises appear around pasted photo like this:
(Zoom photo to see noises. I think it is due from Antialiasing) But I want to paste with sharp boundaries like here :
I am using this codes for paste:
my_image.convert('RGBA')
background = Image.new("RGBA", (background_size), background_color)
background.paste( my_image, (coordinates), my_image )
background.save("result.jpg")
What sholud i do for pasting with sharp boundaries? Thanks.
Upvotes: 1
Views: 1180
Reputation: 76254
jpg is a lossy format, so it may blur your image or add noise, in order to save memory. Use a lossless format like png instead:
background.save("result.png")
Upvotes: 3