Bitmap Image GetWidth or GetPixelWidth always returns 0
Posted: 27 Jan 2025, 21:02
Hey! I'm loading an image from code using a BitmapImage and trying to read its width and height.
For some reason those are always returning 0 for me but I would expect to get the size of the image in pixels (at least with GetPixelWidth).
The image can be used and displays perfectly fine when using it for a brush later in the code so I doubt its the image being corrupt or not found.
The same is also happening for the height.
What am I missing here, or is this a bug?
minimal repro:
For some reason those are always returning 0 for me but I would expect to get the size of the image in pixels (at least with GetPixelWidth).
The image can be used and displays perfectly fine when using it for a brush later in the code so I doubt its the image being corrupt or not found.
The same is also happening for the height.
What am I missing here, or is this a bug?
minimal repro:
Code: Select all
const auto image = Noesis::MakePtr<Noesis::BitmapImage>(Noesis::Uri("Path/To/Image/image.png"));
const int pixelWidth = image->GetPixelWidth(); // Will always return 0
const int width = image->GetWidth(); // Will always return 0