New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does paste_faces_to_input_image support PNG transparency? #13
Comments
Linked issue: |
@woctezuma do you have any idea if this is even possible? |
I have not checked the source code, but this should be possible a priori: in the worst case, it should be a matter of keeping a mask of the transparent area in the input, and using it in the output. References to other repositories (with commits) and documentation: |
@woctezuma i tried looking at the code but it's not easy to understand without much context and experience in this field - I'm looking for someone with knowledge of the code base to provide some support either explaining to me how to implement this or to be paid to implement it. Would you be available for a chat? |
My suggestion would be to look for solutions with the keywords "transparency", "mask" and "merge", similar to: What you want to do is merge a part of the output (improved faces) into the input (original image with transparent background).
Sorry, this could require too much time, as I am not familiar with the code base to be able to quickly help on this matter. For info, I have only contributed in a minor way to this project by replacing a function with a call to a built-in function. efeacb3 |
Thank's to chat-gpt. `from PIL import Image
apply_transparency("./org.png", "./res.png")` In this example, the apply_transparency() function takes two arguments - the path to the source image file that contains the transparency data, and the path to the target image file that you want to apply the transparency to. The function loads both images using the Image.open() method, and gets the pixel values as 2D arrays using the load() method. Then, the function loops through all the pixels in the source image, checks if each pixel is transparent, and if it is, applies the transparency to the corresponding pixel in the target image by setting its RGBA value to (0, 0, 0, 0) - i.e., fully transparent. Finally, the function saves the modified target image to a new file named 'output.png'. You can modify this code to suit your specific needs - for example, you can pass the output filename as an argument to the function, or modify the transparency value to make it less opaque, etc. |
I am using this image in https://github.com/TencentARC/GFPGAN and the background turns black after calling
paste_faces_to_input_image
. Is there a way to implement support for PNG transparent background?Thanks
The text was updated successfully, but these errors were encountered: