# BitmapImage does not work with relative path image file

**URL:** <https://community.thinkgeo.com/t/bitmapimage-does-not-work-with-relative-path-image-file/9736>\
**Category:** ThinkGeo UI for Desktop\
**Created:** [February 14, 2020, 8:52pm UTC](https://community.thinkgeo.com/t/bitmapimage-does-not-work-with-relative-path-image-file/9736 "2020-02-14T20:52:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liang\_Lu](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@Liang\_Lu](https://community.thinkgeo.com/u/Liang_Lu)\
**Post date:** [February 14, 2020, 8:52pm UTC](https://community.thinkgeo.com/t/bitmapimage-does-not-work-with-relative-path-image-file/9736/1 "2020-02-14T20:52:09Z")

</div>

Hi,

When I use relative path for image, the image does not show.

Marker marker = new Marker(new PointShape(projection.ConvertToInternalProjection(place.Location.Geoposition.Longitude, place.Location.Geoposition.Latitude)));

marker.ImageSource = new BitmapImage(new Uri(“Assets/AQUABLANK.png”, UriKind.Relative));

I have to use absolute path for AQUABLANK.png.

Yes, I made sure that AQUABLANK.png property set to “Copy if newer”.

Please take a look. Thanks,

Liang

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [February 17, 2020, 6:57am UTC](https://community.thinkgeo.com/t/bitmapimage-does-not-work-with-relative-path-image-file/9736/2 "2020-02-17T06:57:18Z")

</div>

Hi Liang,

This post is under Desktop category, but the folder looks like Mobile version. Could you please let us know which version you are using?

If that’s for Android, I found some topics from internet it mentioned relative path is not good solution for Android, I think you should want to reference the sample code about path [MainActivity.cs](https://community.thinkgeo.com/uploads/short-url/khPOdbwTNmJ7VYPHtRDipz9ryPa.cs) (3.8 KB) :

I hope that’s helpful.

Regards,

Ethan

---

<div class="post-metadata">

**Author:** ![Liang\_Lu](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/l/3bc359/32.png) [@Liang\_Lu](https://community.thinkgeo.com/u/Liang_Lu)\
**Post date:** [February 17, 2020, 2:10pm UTC](https://community.thinkgeo.com/t/bitmapimage-does-not-work-with-relative-path-image-file/9736/3 "2020-02-17T14:10:21Z")

</div>

Hi Ethan,

I am using Desktop .net core 3.1 WPF.

Thanks,

Liang

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [February 18, 2020, 10:14am UTC](https://community.thinkgeo.com/t/bitmapimage-does-not-work-with-relative-path-image-file/9736/4 "2020-02-18T10:14:26Z")

</div>

Hi Liang,

Thanks for your information, I had reproduced that.

I am not sure whether it’s a bug, I will double check with our developer team.

Any update I will let you know.

Regards,

Ethan

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [February 20, 2020, 9:14am UTC](https://community.thinkgeo.com/t/bitmapimage-does-not-work-with-relative-path-image-file/9736/5 "2020-02-20T09:14:23Z")

</div>

Hi Liang,

Our developer research it and found it’s not caused by our code, here is two solutions about it:

1. Choose relative path:

It point to the image which is called “AQUABLANK.png” in a folder called “Assets” with its “Build Action” set to “Resource” in an assembly called “WpfApplication1”.

You can found more information here: [https://docs.microsoft.com/en-us/dotnet/framework/wpf/app-development/pack-uris-in-wpf?redirectedfrom=MSDN](https://docs.microsoft.com/en-us/dotnet/framework/wpf/app-development/pack-uris-in-wpf?redirectedfrom=MSDN)

1. Choose absolute path, but you get it from .net API, it still looks like relative path in your code.

It point to the image which is called “AQUABLANK.png” in a folder called “Assets” with its “Build Action” set to “None” and “Copy to Output Directory” set to “Copy if newer” or “Copy always”.

I tested both of them in .net core version and they work well.

I hope that’s helpful to solve your problem.

Regards,

Ethan
