Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 43809 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
# Steps to reproduce
Download the code sample from https://github.com/williamwilling/xamarin-forms-image-size or follow the steps below.
1. Create a new Xamarin Forms PCL project.
2. Add a new XAML page.
3. Add the following code to the XAML.
<Image x:Name="ResourceImage" HorizontalOptions="Center" VerticalOptions="Center" />
<Image x:Name="FileImage" HorizontalOptions="Center" VerticalOptions="Center" />
4. Add the following code to the constructor of the page in the code behind.
ResourceImage.Source = ImageSource.FromResource("TestApp.test.png");
FileImage.Source = ImageSource.FromFile("test.png");
5. Add an image called `test.png` to the portable project and set `Build Action` to `Embedded Resource`.
6. Add the same image to the `Resources/drawable/` folder of the Android project and set `Build Action` to `AndroidResource`.
7. Add the same image to the `Resources/ folder` of the iOS project and set `Build Action` to `BundleResource`.
8. Add the same image to the root folder of the UWP project and set `Build Action` to `Content`.
9. Set the test page as the starting page in `App.cs`.
10. Build and run the project on each platform.
# Expected behavior
All platforms should show the same picture twice, at full size in both cases. (Maybe smaller if the image doesn't fit in its parent, but at least both images should have the same size.)
# Actual behavior
* UWP exhibits the expected behavior.
* iOS shows the image loaded with `ImageSource.FromFile` at full size, and the image loaded with `ImageSource.FromResource` at half size.
* Android shows the image loaded with `ImageSource.FromFile` at full size, and the image loaded with `ImageSource.FromResource` at one-third the size.
Using `ImageSource.FromStream` instead of `ImageSource.FromResource` gives the same results, regardless of whether the stream is created from an embedded resource or from a file on the file system.
# Supplemental info (logs, images, videos)
Code available at https://github.com/williamwilling/xamarin-forms-image-size
# Test environment (full version information)
* Xamarin Forms v18.104.22.16882 and v22.214.171.124
* Android 5.0 (API 21)
* iOS 9.3
* Windows 10, Build 1056 with UWP v5.0.0 and v5.2.2
Developed with Visual Studio Enterprise 2015 with all updates installed.
Created attachment 17889 [details]
Zip of git repo with fixes
Relative image sizes differ between platforms.