# FileImageSource and density: defining density and why doesnt it behave?

**URL:** <https://forums.fusetools.com/t/fileimagesource-and-density-defining-density-and-why-doesnt-it-behave/1531>\
**Category:** General\
**Created:** [October 18, 2016, 7:59pm UTC](https://forums.fusetools.com/t/fileimagesource-and-density-defining-density-and-why-doesnt-it-behave/1531 "2016-10-18T19:59:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ted.ekeroth](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@ted.ekeroth](https://forums.fusetools.com/u/ted.ekeroth)\
**Post date:** [October 18, 2016, 7:59pm UTC](https://forums.fusetools.com/t/fileimagesource-and-density-defining-density-and-why-doesnt-it-behave/1531/1 "2016-10-18T19:59:16Z")

</div>

So, I am testing this image:

```auto
<Page ux:Class="SplashScreen">
    <Image>
    	<MultiDensityImageSource>
    		<FileImageSource File="../assets/AlfaProIcon_48x48_mdpi.png" Density="1"/>
    		<FileImageSource File="../assets/AlfaProIcon_72x72_hdpi.png" Density="2"/>
    		<FileImageSource File="../assets/AlfaProIcon_96x96_xhdpi.png" Density="3"/>
    		<FileImageSource File="../assets/AlfaProIcon_144x144_xxhdpi.png" Density="4"/>
    		<FileImageSource File="../assets/AlfaProIcon_192x192_xxxhdpi.png" Density="5"/>
    		<FileImageSource File="../assets/AlfaProIcon_512x512.png" Density="6"/> 
    	</MultiDensityImageSource>
    </Image>
</Page>

```

But Im not sure what to put in the Density property. In the examples and videos, you start at 1 with the lowest res image, and then go up, but im not sure where hte numbers come from? can someone explain?

If I run it on my Nexus 5X, it seems like it always takes the 96x96 and showing on the screen, so density 3.

Thanks =)

---

<div class="post-metadata">

**Author:** ![kusma](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/kusma/32/595_2.png) [@kusma](https://forums.fusetools.com/u/kusma)\
**Post date:** [October 25, 2016, 11:07am UTC](https://forums.fusetools.com/t/fileimagesource-and-density-defining-density-and-why-doesnt-it-behave/1531/2 "2016-10-25T11:07:18Z")

</div>

@ted: The density is the “scale factor” of the image. Each image is a grid of pixels, but we need to map these pixels to set of device-independent points to retain physical sizes across different devices. The density tells us what kind of pixel-to-point ratio the image is intended for. You can generally think of it like a multiplier on the size of the “base”-image.

According to [https://design.google.com/devices/](https://design.google.com/devices/), Nexus 5X has a density of 2.6, meaning that density=3 is the closest fit. So I believe this works as expected, you get the closest fitting image. However, you might want to set StretchMode=“PixelPrecise” on the image to prevent artifacts from resampling.
