|Topic was automatically imported from the old Question2Answer platform.
I have an image and I would like to use it as texture for a circular node. How do I do it?
CanvasItem.draw_circle method but it draws a circle filled with a single color.
What I need is, provided an image, I should be able to draw it as a circle. This image is dynamic.
The only solution I could think of so far is to use an external program like ImageMagick to convert the image to a circular image and then use it as a texture.
convert -size 200x200 xc:none -fill walter.jpg -draw "circle 100,100 100,1" circle_thumb.png
But this creates an extra dependency. Please share your thoughts and ideas that helps me achieve this through Godot itself.
Images are rectangular in nature. While that
ImageMagick command may produce a visually circular image, the result is just a PNG file, which will contain a rectangular image definition.
With that in mind, it’d be helpful to know what you want to happen to the pixels that are “outside” of your circular boundary. Should they be drawn in some pre-defined color (black maybe?) or be completely transparent, or something else?
I believe you should be able to reproduce any reasonable combination of the above using Godot’s built-in image and pixel processing capabilities - it just depends on the goal.
jgodfrey | 2023-04-26 16:55
Yes, ImageMagick produces rectangular image with a cropped circle such that the region outside the circle is transparent. I want to replicate the same
arun_mani_j | 2023-04-27 01:45