<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Python GUIs - textures</title><link href="https://www.pythonguis.com/" rel="alternate"/><link href="https://www.pythonguis.com/feeds/textures.tag.atom.xml" rel="self"/><id>https://www.pythonguis.com/</id><updated>2024-05-07T09:00:00+00:00</updated><subtitle>Create GUI applications with Python and Qt</subtitle><entry><title>Adding Images in DearPyGui — Learn every way to load, display, and manipulate images in your DearPyGui applications</title><link href="https://www.pythonguis.com/faq/adding-images-in-dearpygui/" rel="alternate"/><published>2024-05-07T09:00:00+00:00</published><updated>2024-05-07T09:00:00+00:00</updated><author><name>Martin Fitzpatrick</name></author><id>tag:www.pythonguis.com,2024-05-07:/faq/adding-images-in-dearpygui/</id><summary type="html">DearPyGui handles images a little differently than most Python GUI frameworks. Instead of simply pointing to a file and placing it on screen, you first load image data into a &lt;strong&gt;texture&lt;/strong&gt;, and then you display that texture using a widget. This two-step process can be a bit confusing at first, but it gives you a lot of flexibility &amp;mdash; including the ability to update images on the fly.</summary><content type="html">&lt;p&gt;DearPyGui handles images a little differently than most Python GUI frameworks. Instead of simply pointing to a file and placing it on screen, you first load image data into a &lt;strong&gt;texture&lt;/strong&gt;, and then you display that texture using a widget. This two-step process can be a bit confusing at first, but it gives you a lot of flexibility &amp;mdash; including the ability to update images on the fly.&lt;/p&gt;
&lt;p&gt;In this tutorial, we'll walk through every way to add images to a DearPyGui application, starting with the simplest approach and building up to more advanced techniques.&lt;/p&gt;
&lt;h2 id="understanding-the-texture-registry"&gt;Understanding the Texture Registry&lt;/h2&gt;
&lt;p&gt;Before we display any image, we need to understand a core concept: the &lt;strong&gt;texture registry&lt;/strong&gt;. In DearPyGui, all image data lives inside a texture registry. Think of it as a central storage area where your app keeps all its image data. Widgets then reference textures from this registry by their tag.&lt;/p&gt;
&lt;p&gt;Here's the basic flow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Load&lt;/strong&gt; image data (from a file or from code).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Register&lt;/strong&gt; that data as a texture in the texture registry.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Display&lt;/strong&gt; the texture using an image widget (or other display method).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let's see this in practice.&lt;/p&gt;
&lt;h2 id="loading-images-with-dpgload_image"&gt;Loading Images with &lt;code&gt;dpg.load_image()&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;DearPyGui provides a built-in helper function, &lt;code&gt;dpg.load_image()&lt;/code&gt;, that loads an image file and returns the data in exactly the format the texture registry expects.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;width, height, channels, data = dpg.load_image("my_image.png")
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This function returns four values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;width&lt;/strong&gt; &amp;mdash; the image width in pixels&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;height&lt;/strong&gt; &amp;mdash; the image height in pixels&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;channels&lt;/strong&gt; &amp;mdash; the number of color channels (3 for RGB, 4 for RGBA)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;data&lt;/strong&gt; &amp;mdash; a flat list of pixel values, normalized to floats between 0.0 and 1.0&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;load_image()&lt;/code&gt; function supports common formats like PNG, JPG, and BMP. If the file can't be found or loaded, it returns &lt;code&gt;None&lt;/code&gt; &amp;mdash; so it's good practice to check for that.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;result = dpg.load_image("my_image.png")
if result is None:
    print("Failed to load image!")
else:
    width, height, channels, data = result
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now let's put this data to use.&lt;/p&gt;
&lt;h2 id="method-1-static-textures"&gt;Method 1: Static Textures&lt;/h2&gt;
&lt;p&gt;A &lt;strong&gt;static texture&lt;/strong&gt; is the simplest and most common way to display an image. Once created, its pixel data cannot be changed. This makes it perfect for icons, logos, backgrounds, or any image that doesn't need to update.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;import dearpygui.dearpygui as dpg

dpg.create_context()

width, height, channels, data = dpg.load_image("my_image.png")

with dpg.texture_registry():
    dpg.add_static_texture(
        width=width,
        height=height,
        default_value=data,
        tag="my_texture"
    )

with dpg.window(label="Image Example", width=600, height=400):
    dpg.add_image("my_texture")

dpg.create_viewport(title="Static Image", width=700, height=500)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Let's break down what's happening:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;We load the image file with &lt;code&gt;dpg.load_image()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Inside a &lt;code&gt;texture_registry&lt;/code&gt; block, we create a static texture and give it the tag &lt;code&gt;"my_texture"&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;In our window, we use &lt;code&gt;dpg.add_image()&lt;/code&gt; and pass the texture's tag.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That's it! The image appears in your window.&lt;/p&gt;
&lt;h3&gt;Sizing the Image&lt;/h3&gt;
&lt;p&gt;By default, &lt;code&gt;dpg.add_image()&lt;/code&gt; displays the image at its original pixel dimensions. You can override this with the &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; parameters:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;dpg.add_image("my_texture", width=200, height=150)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This scales the image to 200&amp;times;150 pixels in the UI, regardless of the original image dimensions.&lt;/p&gt;
&lt;h3&gt;Displaying a Portion of the Image with UV Coordinates&lt;/h3&gt;
&lt;p&gt;You can also display just a portion of the texture using &lt;strong&gt;UV coordinates&lt;/strong&gt;. UV coordinates range from &lt;code&gt;(0, 0)&lt;/code&gt; at the top-left corner to &lt;code&gt;(1, 1)&lt;/code&gt; at the bottom-right corner.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;# Display only the top-left quarter of the image
dpg.add_image("my_texture", uv_min=(0, 0), uv_max=(0.5, 0.5))
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This is useful for sprite sheets or when you want to crop an image without modifying the source file.&lt;/p&gt;
&lt;h2 id="method-2-dynamic-textures"&gt;Method 2: Dynamic Textures&lt;/h2&gt;
&lt;p&gt;What if you need to update an image after it's been created? That's where &lt;strong&gt;dynamic textures&lt;/strong&gt; come in. A dynamic texture works exactly like a static texture, except you can modify its pixel data at any time.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;import dearpygui.dearpygui as dpg

dpg.create_context()

# Create a 200x200 red image (RGBA)
tex_width, tex_height = 200, 200
texture_data = []
for y in range(tex_height):
    for x in range(tex_width):
        texture_data.extend([1.0, 0.0, 0.0, 1.0])  # Red, fully opaque

with dpg.texture_registry():
    dpg.add_dynamic_texture(
        width=tex_width,
        height=tex_height,
        default_value=texture_data,
        tag="dynamic_texture"
    )

def make_blue(sender, app_data):
    new_data = []
    for y in range(tex_height):
        for x in range(tex_width):
            new_data.extend([0.0, 0.0, 1.0, 1.0])  # Blue
    dpg.set_value("dynamic_texture", new_data)

with dpg.window(label="Dynamic Texture", width=400, height=400):
    dpg.add_image("dynamic_texture")
    dpg.add_button(label="Change to Blue", callback=make_blue)

dpg.create_viewport(title="Dynamic Image", width=500, height=500)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The key line is &lt;code&gt;dpg.set_value("dynamic_texture", new_data)&lt;/code&gt;. This replaces all the pixel data in the texture, and the displayed image updates immediately.&lt;/p&gt;
&lt;p&gt;Dynamic textures are ideal for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Live previews (e.g., a color picker preview)&lt;/li&gt;
&lt;li&gt;Procedurally generated graphics&lt;/li&gt;
&lt;li&gt;Video frames or camera feeds&lt;/li&gt;
&lt;li&gt;Any image that changes in response to user interaction&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Performance Tip&lt;/h3&gt;
&lt;p&gt;Generating large texture data in pure Python (as we did above with nested loops) can be slow. For real applications, consider using &lt;strong&gt;NumPy&lt;/strong&gt; to create and manipulate pixel data, then convert it to a flat list:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;import numpy as np

# Create a 200x200 green image
pixels = np.zeros((200, 200, 4), dtype=np.float32)
pixels[:, :, 1] = 1.0  # Green channel
pixels[:, :, 3] = 1.0  # Alpha channel
texture_data = pixels.flatten().tolist()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This is dramatically faster for larger images.&lt;/p&gt;
&lt;h2 id="method-3-raw-textures"&gt;Method 3: Raw Textures&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Raw textures&lt;/strong&gt; are a more advanced option designed for maximum performance. Unlike static and dynamic textures, raw textures accept data as a flat array and give you direct control over the pixel format. They support formats like &lt;code&gt;dpg.mvFormat_Float_rgba&lt;/code&gt;, &lt;code&gt;dpg.mvFormat_Float_rgb&lt;/code&gt;, and integer-based formats.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;import dearpygui.dearpygui as dpg
import array

dpg.create_context()

tex_width, tex_height = 100, 100

# Using the array module for more efficient storage
raw_data = array.array('f')  # 'f' = float
for y in range(tex_height):
    for x in range(tex_width):
        raw_data.extend([0.0, 1.0, 0.0, 1.0])  # Green, RGBA

with dpg.texture_registry():
    dpg.add_raw_texture(
        width=tex_width,
        height=tex_height,
        default_value=raw_data,
        format=dpg.mvFormat_Float_rgba,
        tag="raw_texture"
    )

with dpg.window(label="Raw Texture", width=300, height=300):
    dpg.add_image("raw_texture")

dpg.create_viewport(title="Raw Texture Example", width=400, height=400)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The big advantage of raw textures is that when you modify the underlying &lt;code&gt;array.array&lt;/code&gt; (or NumPy array) data, the texture updates &lt;strong&gt;automatically&lt;/strong&gt; &amp;mdash; you don't need to call &lt;code&gt;dpg.set_value()&lt;/code&gt;. The texture reads directly from the buffer.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;def update_raw():
    """Modify the buffer in place &amp;mdash; the texture updates automatically."""
    for i in range(0, len(raw_data), 4):
        raw_data[i] = 1.0      # Red
        raw_data[i + 1] = 0.0  # Green off
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This makes raw textures the best choice for high-performance scenarios where you're updating image data every frame, such as real-time visualizations or video playback.&lt;/p&gt;
&lt;h3&gt;Available Formats&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format Constant&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dpg.mvFormat_Float_rgba&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;4 floats per pixel (RGBA)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dpg.mvFormat_Float_rgb&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;3 floats per pixel (RGB)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="method-4-image-buttons"&gt;Method 4: Image Buttons&lt;/h2&gt;
&lt;p&gt;Sometimes you want an image that the user can click &amp;mdash; like an icon button or a clickable thumbnail. DearPyGui provides &lt;code&gt;dpg.add_image_button()&lt;/code&gt; for exactly this purpose.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;import dearpygui.dearpygui as dpg

dpg.create_context()

width, height, channels, data = dpg.load_image("button_icon.png")

with dpg.texture_registry():
    dpg.add_static_texture(
        width=width,
        height=height,
        default_value=data,
        tag="button_texture"
    )

def on_click(sender, app_data):
    print("Image button clicked!")

with dpg.window(label="Image Button", width=400, height=300):
    dpg.add_image_button(
        "button_texture",
        width=64,
        height=64,
        callback=on_click
    )

dpg.create_viewport(title="Image Button Example", width=500, height=400)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;add_image_button()&lt;/code&gt; widget behaves just like a regular button &amp;mdash; it supports callbacks, can be enabled/disabled, and responds to clicks &amp;mdash; but it renders your texture instead of text.&lt;/p&gt;
&lt;p&gt;You can also use UV coordinates with image buttons to display a cropped portion of a texture, which is great for toolbar icons stored in a single sprite sheet:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;dpg.add_image_button(
    "sprite_sheet",
    width=32,
    height=32,
    uv_min=(0.0, 0.0),
    uv_max=(0.25, 0.25),
    callback=on_click
)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h2 id="method-5-images-on-the-drawing-api"&gt;Method 5: Images on the Drawing API&lt;/h2&gt;
&lt;p&gt;DearPyGui includes a powerful &lt;strong&gt;drawing API&lt;/strong&gt; that lets you draw shapes, lines, text, and images onto a canvas. This is useful when you need precise control over image positioning, or when you're building something like a game, diagram editor, or custom visualization.&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;import dearpygui.dearpygui as dpg

dpg.create_context()

width, height, channels, data = dpg.load_image("my_image.png")

with dpg.texture_registry():
    dpg.add_static_texture(
        width=width,
        height=height,
        default_value=data,
        tag="draw_texture"
    )

with dpg.window(label="Drawing Canvas", width=600, height=500):
    with dpg.drawlist(width=500, height=400):
        dpg.draw_image(
            "draw_texture",
            pmin=(50, 50),
            pmax=(250, 250)
        )

dpg.create_viewport(title="Drawing API Image", width=700, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;With &lt;code&gt;dpg.draw_image()&lt;/code&gt;, you specify:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;pmin&lt;/strong&gt; &amp;mdash; the top-left corner position on the canvas&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;pmax&lt;/strong&gt; &amp;mdash; the bottom-right corner position on the canvas&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The image is stretched (or shrunk) to fill the rectangle defined by these two points. You can also use &lt;code&gt;uv_min&lt;/code&gt; and &lt;code&gt;uv_max&lt;/code&gt; to display a portion of the texture.&lt;/p&gt;
&lt;h3&gt;Layering Images&lt;/h3&gt;
&lt;p&gt;One powerful feature of the drawing API is layering. You can draw multiple images on top of each other, combine them with shapes and text, and control the draw order:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;with dpg.drawlist(width=500, height=400):
    # Background image
    dpg.draw_image("background_texture", pmin=(0, 0), pmax=(500, 400))
    # Foreground character
    dpg.draw_image("character_texture", pmin=(100, 100), pmax=(200, 200))
    # Label on top
    dpg.draw_text((100, 210), "Player 1", size=20, color=(255, 255, 255))
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Items are drawn in order, so later items appear on top of earlier ones.&lt;/p&gt;
&lt;h2 id="method-6-images-on-node-editors-and-plots"&gt;Method 6: Images on Node Editors and Plots&lt;/h2&gt;
&lt;p&gt;You can also place images onto &lt;strong&gt;plots&lt;/strong&gt; and inside &lt;strong&gt;node editors&lt;/strong&gt;, using the same texture-based approach.&lt;/p&gt;
&lt;h3&gt;Images on Plots&lt;/h3&gt;
&lt;p&gt;Placing an image on a plot is useful for heatmaps, annotated charts, or background reference images:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;with dpg.plot(label="Plot with Image", width=500, height=400):
    dpg.add_plot_axis(dpg.mvXAxis, label="X")
    with dpg.plot_axis(dpg.mvYAxis, label="Y"):
        dpg.add_image_series(
            "my_texture",
            bounds_min=(0, 0),
            bounds_max=(10, 10)
        )
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;bounds_min&lt;/code&gt; and &lt;code&gt;bounds_max&lt;/code&gt; parameters define the position in &lt;strong&gt;plot coordinates&lt;/strong&gt; (not pixel coordinates), so the image scales and pans along with the plot axes.&lt;/p&gt;
&lt;h2 id="using-pillow-pil-to-load-images"&gt;Using Pillow (PIL) to Load Images&lt;/h2&gt;
&lt;p&gt;While &lt;code&gt;dpg.load_image()&lt;/code&gt; works well for basic image loading, you might want to use &lt;strong&gt;Pillow&lt;/strong&gt; for more advanced image manipulation &amp;mdash; resizing, filtering, compositing, or loading formats that &lt;code&gt;load_image()&lt;/code&gt; doesn't support.&lt;/p&gt;
&lt;p&gt;Here's how to bridge Pillow and DearPyGui:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;import dearpygui.dearpygui as dpg
from PIL import Image
import numpy as np

dpg.create_context()

# Load and process with Pillow
img = Image.open("my_image.png").convert("RGBA")
img = img.resize((200, 200))  # Resize as needed

# Convert to DearPyGui-compatible format
img_array = np.array(img, dtype=np.float32) / 255.0  # Normalize to 0.0&amp;ndash;1.0
texture_data = img_array.flatten().tolist()

with dpg.texture_registry():
    dpg.add_static_texture(
        width=200,
        height=200,
        default_value=texture_data,
        tag="pil_texture"
    )

with dpg.window(label="Pillow Image", width=400, height=400):
    dpg.add_image("pil_texture")

dpg.create_viewport(title="Pillow + DearPyGui", width=500, height=500)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The critical step is &lt;strong&gt;normalizing the pixel values&lt;/strong&gt;. Pillow stores pixels as integers (0&amp;ndash;255), but DearPyGui textures expect floats (0.0&amp;ndash;1.0). Dividing by 255.0 handles this conversion.&lt;/p&gt;
&lt;h2 id="showing-the-texture-registry-debugging"&gt;Showing the Texture Registry (Debugging)&lt;/h2&gt;
&lt;p&gt;When you're working with multiple textures, it can be hard to keep track of what's loaded. DearPyGui provides a built-in debug tool that shows you everything in the texture registry:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;dpg.show_item_registry()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You can also make the texture registry visible with a simple call:&lt;/p&gt;
&lt;div class="code-block"&gt;
&lt;span class="code-block-language code-block-python"&gt;python&lt;/span&gt;
&lt;pre&gt;&lt;code class="python"&gt;with dpg.texture_registry(show=True):
    dpg.add_static_texture(width=w, height=h, default_value=data, tag="tex1")
    dpg.add_static_texture(width=w2, height=h2, default_value=data2, tag="tex2")
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Setting &lt;code&gt;show=True&lt;/code&gt; on the texture registry opens a window that displays thumbnails of all registered textures. This is extremely helpful during development.&lt;/p&gt;
&lt;h2 id="quick-reference-choosing-the-right-approach"&gt;Quick Reference: Choosing the Right Approach&lt;/h2&gt;
&lt;p&gt;Here's a summary to help you decide which method to use:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;th&gt;Can Update?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Static Texture&lt;/strong&gt; + &lt;code&gt;add_image()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Icons, logos, static images&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Dynamic Texture&lt;/strong&gt; + &lt;code&gt;add_image()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Live previews, procedural images&lt;/td&gt;
&lt;td&gt;Yes (via &lt;code&gt;set_value()&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Raw Texture&lt;/strong&gt; + &lt;code&gt;add_image()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;High-performance updates, video&lt;/td&gt;
&lt;td&gt;Yes (automatic from buffer)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Image Button&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Clickable icons, toolbars&lt;/td&gt;
&lt;td&gt;No (use dynamic texture if needed)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Drawing API&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Precise positioning, layering, games&lt;/td&gt;
&lt;td&gt;No (redraw to update)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Plot Image Series&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Data visualization overlays&lt;/td&gt;
&lt;td&gt;No (use dynamic texture if needed)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="summary"&gt;Summary&lt;/h2&gt;
&lt;p&gt;Adding images to DearPyGui follows a consistent pattern: load your pixel data, register it as a texture, then display it with a widget. The flexibility of this approach means you can use the same texture data in multiple places &amp;mdash; an image widget, a button, a drawing canvas, or a plot &amp;mdash; without duplicating the data.&lt;/p&gt;
&lt;p&gt;Start with static textures and &lt;code&gt;dpg.add_image()&lt;/code&gt; for most use cases. When you need images that change, reach for dynamic textures. And when performance is critical, raw textures give you the fastest path to getting pixels on screen.&lt;/p&gt;
&lt;p&gt;The most important thing is to experiment. Try loading different images, changing their sizes, combining the drawing API with image widgets, and updating textures in response to user actions. The texture system in DearPyGui is powerful, and once you're comfortable with the pattern, you'll find images easy to work with across your entire application.&lt;/p&gt;</content><category term="python"/><category term="dearpygui"/><category term="images"/><category term="gui"/><category term="textures"/></entry></feed>