Skip to content

Is it possible to scale an image/texture? #1789

Discussion options

You must be logged in to vote

I figured out how to do this. You just need to change the width and height in the add_image call, not in the add_static_texture call. If you scale both height and width by the same factor you'll get the scaling you want.

dpg.add_image("texture_tag", width=int(dpg.get_item_width("texture_tag") * 0.4), height=int(dpg.get_item_height("texture_tag") * 0.4))

Would scale to 40% original size for example.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by keck-in-space
Comment options

You must be logged in to vote
1 reply
@cornradio
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants