How to save an UI icon to a .png file?

I’m building a Game Engine and I need those icons to be used in my engine, that’s why I ask the question. Print Screen is bad because it doesn’t have an alpha channel.

Just indices are enough like links or hints or something, because a complete python code maybe difficult for you. Thank you.

I tried to Google but I don’t see a solution because nobody asks such question, no body wants to build such Game Engine.
I cannot find the .png files of the normal icons in the Blender Source Code folder, only the brush icons.

import bpy

# Referenced from https://gist.github.com/eliemichel/251731e6cc711340dfefe90fe7e38ac9

class IconPanel(bpy.types.Panel):
    """Creates a Panel width all possible icons"""
    bl_label = "Icons"
    bl_idname = "icons_panel"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        icons = [
            'COLORSET_02_VEC',
            'COLORSET_03_VEC',
            'COLORSET_04_VEC',
        ]
        for i in icons:
            row = self.layout.row()
            row.label(text=i, icon=i)

bpy.utils.register_class(IconPanel)

I don’t think there’s an official way to do this, but you can get all of the individual icon svgs here:

1 Like

Thank you so much, it’s very helpful.