Closed Ennorath closed 3 years ago
Hi, thanks for your attention!
Since the server is hold by the Gradio team. I will try to contact with them for supporting this function. Maybe you can use our Colab demo to download the predicted alpha matte.
Hey @Ennorath, I developed the gradio link. I'm a bit confused, you can already download the png by right clicking on the image. See GIF:
Is this what is being requested?
@aliabd
Hi. Thanks for your help!
I think @Ennorath want a foreground PNG image with a transparent background.
To achieve this, for the PNG image (with four channels) shown in MATTE_IMAGE
, we need to save the original image to the first three channels and save the alpha matte to the last channel. I have modified and tested the code locally. In your fork demo.py
, please change (L67-L68):
matte_mask = np.repeat(matte[:, :, None], 3, axis=2)
foreground = im_np * matte_mask + (1 - matte_mask) * 255
to
# matte_mask = np.repeat(matte[:, :, None], 3, axis=2)
# foreground = im_np * matte_mask + (1 - matte_mask) * 255
foreground = np.concatenate((im_np, matte[:, :, None] * 255), axis=2)
I agree that it makes more sense to show a transparent background rather than a colorful one.
@aliabd Hi. Thanks for your help! I think @Ennorath want a foreground PNG image with a transparent background. To achieve this, for the PNG image (with four channels) shown in
MATTE_IMAGE
, we need to save the original image to the first three channels and save the alpha matte to the last channel. I have modified and tested the code locally. In your forkdemo.py
, please change (L67-L68):matte_mask = np.repeat(matte[:, :, None], 3, axis=2) foreground = im_np * matte_mask + (1 - matte_mask) * 255
to
# matte_mask = np.repeat(matte[:, :, None], 3, axis=2) # foreground = im_np * matte_mask + (1 - matte_mask) * 255 foreground = np.concatenate((im_np, matte[:, :, None] * 255), axis=2)
I agree that it makes more sense to show a transparent background than a colorful one.
Thanks, yeah, sorry for my English. It's exactly what I meant. Thank you! Hope Gradio Team will allow to add feature to download picture with transparent background, it would be fantastic! :) Waiting for the updates! And Thanks for the project! It really useful
@Ennorath I will @ you when this feature is supported.
Hey @Ennorath, @ZHKKKe
I understood what you meant and have updated the demo link: https://gradio.app/g/modnet
Thanks, let me know if this is what you requested.
Hey @Ennorath, @ZHKKKe
I understood what you meant and have updated the demo link: https://gradio.app/g/modnet
Thanks, let me know if this is what you requested.
Hey! Thanks!!! It's Awesome!
I'm talking about this website - https://gradio.app/g/modnet It would be much better, if users will be able to download png file without background at all. Is it possible in future? Will you update it later?