Open keck-in-space opened 2 years ago
Another issue I noticed with this is that the RAM usage is very high at over 2GB to display this image. I do not know where that RAM requirement could be coming from.
perhaps related to #1109
I had an issue opening my images at all so I used pillow and numpy to load them:
def add_static_image(filename, width, height, *args, **kwargs):
with importlib.resources.path(images, filename) as img_file:
try:
width, height, _, data = dpg.load_image(img_file)
except SystemError:
warn(
"DearPyGUI load_image failed. Trying PIL Image.open...",
stacklevel=2,
)
image = Image.open(img_file).resize((width, height))
# width, height = image.size
data = np.frombuffer(image.tobytes(), dtype=np.uint8) / 255.0
dpg.add_static_texture(
width,
height,
data,
*args,
# format=dpg.mvFormat_Float_rgba,
**kwargs,
)
Try this instead of dpg.load_image
:
image = Image.open(img_file).resize((width, height))
width, height = image.size
data = np.frombuffer(image.tobytes(), dtype=np.uint8) / 255.0
@keck-in-space I saw you work at NASA. I’m now working at NASA (JSC) as a contractor. Are you on the DPG discord channel?
@krister-ts and this fixed the ram issue?
@krister-ts and this fixed the ram issue?
Never actually had dpg work for my images...
EDIT:
I mean the load_image
function from DearPyGui to be more clear
@hoffstadt Awesome! Welcome to NASA! I am not on the Discord channel... I don't use Discord for privacy reasons since it is closed source owned by Tencent. Just my opinion lol.
Version of Dear PyGui
Version: 1.6.2 Operating System: Windows 10
My Issue/Question
I have noticed that when I display a texture the GPU usage in Task Manager is very high. I am displaying two textures (two PNG images of about 4MB each, though this also occurs with jpgs), and my GPU usage is about 90% (using a NVIDIA T1200 Laptop GPU).
The weirdest part is that if I am actively loading in new images, the GPU usage drops down to about 40%, but as soon as I stop loading new images in, the GPU goes to 90%.
Also, the frame-rate tanks to close to 20 FPS after the images have been loaded.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
DPG GPU usage would be high during loading and initial display, but lower after the image has been loaded.
Screenshots/Video
You can see before clicking load images, after, and then after the application is closed in this small graph.
Standalone, minimal, complete and verifiable example
Here's the image I used. I renamed it to
nasa.jpg
.