Image files added in Resources/drawable in Android cannot be found - xamarin

I need to add a custom marker on a custom map. The marker png image file was added to Resources/drawable in Android folder. But when I called the below line, the image file name was flagged with red underline. Hovering over it, I saw the message 'Resource.Drawable' does not contain a definition for 'orange_pin_thick_outline_nofill'. The image file's Build Action is set to AndroidResource. I also tried EmbeddedResouce. But the result is the same.
It looks like that none of the image files are recognizable. Those that did show up after I typed Resource.Drawable are probably some built-in images. Any idea how can I get my marker image using FromResource()?
BitmapDescriptorFactory.FromResource(Resource.Drawable.orange_pin_thick_outline_nofill)

Try the full name by adding the file Extension.
try this :
BitmapDescriptorFactory.FromBundle("your_image.png");
or :
BitmapDescriptorFactory.FromView(new BindingPinView("", "your_image.png"));

Related

Broken Image Links in Markdown

I am working on the .md file in the following location:
https://github.com/markroche92/SDND-Traffic-Sign-Classification/blob/master/writeup_template.md
None of my linked images are appearing when I view the .md file in Github. I have used the following markdown code to attempt to link the images:
---
**Build a Traffic Sign Recognition Project**
[//]: # (Image References)
[image1]: ./histogram_input_data.png "Input_Data"
[image2]: ./Label26.png "Label_26"
[image3]: ./Label36.png "Label_36"
[image4]: ./Label41.png "Label_41"
[image5]: ./channels.png "Channels"
[image6]: ./nn_results.png "NN_Results"
[image7]: ./GermanRoadSigns/x32/132.jpg "Img_1"
[image8]: ./GermanRoadSigns/x32/232.jpg "Img_2"
[image9]: ./GermanRoadSigns/x32/332.jpg "Img_3"
[image10]: ./GermanRoadSigns/x32/432.jpg "Img_4"
[image11]: ./GermanRoadSigns/x32/532.jpg "Img_5"
[image12]: ./int_ims.png "Performance"
[image13]: ./top_five_predictions.png "Top_Five_Predictions"
[image14]: ./structure.jpg "Network_structure"
---
...
The following histogram shows the distribution of training, validation and
test set images per label:
![alt text][image1]
An example image was visualised for each label. Three are displayed below:
![alt text][image2]
![alt text][image3]
![alt text][image4]
Each image has three channels (red, green, blue). The three channels are
visualized below for an example image:
![alt text][image5]
However, none of the images seem to be appearing when .md is viewed on Github. Can anyone show me where I am going wrong here?
In the actual .md file you are not using relative URLs like in your supposed quote, but absolute ones like this:
https://github.com/markroche92/SDND-Traffic-Sign-Classification/blob/master/structure.JPG
This won’t work because it is actually a standard GitHub file page, not the image itself. To link to the image, remove /blob from the path and change the domain to rawgit.com – or actually use relative URLs with or without leading ./, but make sure to get the letter case right.
https://rawgit.com/markroche92/SDND-Traffic-Sign-Classification/master/structure.JPG
structure.JPG
I also had this issue on some of my images, but not others. It ended up being how I capitalized my image names in my markdown file. For example:
Image name on my computer:
oneGreatImage.png
Image name in my Markdown file:
onegreatImage.png
When I capitalized the G again and pushed the changes it loaded just fine.
It appears that GitHub is VERY picky about matching the filenames on the images so double check that.

What is the format "BM6"?

I am working with an old system of palletes. When I export an image, it also creates an pallete with 15/16 colors. But when I try to replicate the same result, the program does not recognize the image which I just created. To analyse what happened, I opened some images with notepad and compared them with my "creation" and I noticed quite some differences.
But the most interesting thing was that at the beginning of my images' code was the type "BM6", while they should be "png" or "bmp". I think that is some thing of codification, but I cannot find anything about it.
If the image file is properly formed, then you can take your .bm6 file and simple change / rename the extension to .bmp. And it should suddenly be an image.
.bm6 can result from creating an image file using a text editor, as seen here.

Why don't images used in xibs show up in app wide searches

I am in the process of going through a large project and removing unused image assets. I had been using cmd+shift+f to perform a project wide search for given image names. I'd assumed this was working until I realized that if I set an imageview to display an image in interface builder that image reference was not showing up in my search.
Why doesn't the app wide search look for a value within an xib file?
Below is an image in a sample project which recreates the issue. I'm assigning img2 in the xib, but as you can see in the search results img2.png is not found.

Thumbnail-like behavior using target attribute of image directive

I use Sphinx to generate some docs. I have a reStructuredText document and I'd like to put an image into it. The case is that the image should be clickable so that after a user clicks the image then they should be shown this image in full size. I use the image directive and its target option like this:
.. image:: /images/some_image.png
:alt: Image descripion
:align: center
:target: `big_some_image`_
.. _big_some_image: /images/some_image.png
The problem is that in the rendered page I get:
<img src="../../../_images/some_image.png">
So there is correct src from the image directive but an incorrect href attribute from the hyperlink.
Questions:
is there any way to generate links in the way that image directive does it? I mean relative to the document.
is there any other (built in) way to have "thumbnail-> click -> big image" behaviour?
Simply use the scale option:
.. image:: large_image.png
:scale: 20%
When the scaled image is clicked on, the full image loads in its own window. So this doesn't increase the image size on the page, but that would be messy anyway.
When you use the image directive from within Sphinx, Sphinx does some special handling to find the image file and copy it into your project (like your _images directory), and then renders the HTML to point to that place.
But the target option just takes a URL as a parameter. It knows nothing about your Sphinx project, or how your images are laid out, and does not attempt to guess.
If you want to have it point to a larger version of the same file, you will likely need to do some manual steps (like maybe copying the file to a specific location), or maybe provide a relative URL to the large file, rather than the absolute URL you have in your example.
If you want to go a completely different way, you could also try overriding and modifying the HTML templates for your project to add some JavaScript to get the click-to-larger-image effect you want.
Looks like there is a Sphinx extension that does this now, and quite nicely at that, sphinxcontrib-fancybox 0.3.2. Install with pip, add it to your extensions in conf.py, and use the fancybox directive:
.. fancybox:: images/image.png
Relative links seem to work. For the Mapserver docs setup, if an image is placed in the images directory, a relative link like in the following code works in my local build. Here is an example using figure (the underscore ("_") before "images" in the target link is necessary):
.. figure:: ../../images/carto-elements.png
:height: 400
:width: 600
:align: center
:target: ../../_images/symcon-overlay.png

How to display pictures in the project resource?

I have a set of small icons and hope to display them in my application when certain condition occurs, for example on sunny day, I display the sunny icon.
I can add the jpg files in the picture, and they seem to be uploaded to phone when I deploy the app. However, I don't know how to access these jpgs in my program.
Could someone help? Thanks a lot!
Check this post about content and resources: http://www.windowsphonegeek.com/tips/wp7-working-with-images-content-vs-resource-build-action
To summarize: You should mark your images with a Build Action of Content or Resource, preferably Content. Now you can reference the Content from your Xaml or in code.
If the Build Action for your image resources is set to Content, then you just specify the Source property for the Image control to the relative path to your images:
this._image.Source = new BitmapImage(
new Uri("/Images/myImage.jpg", UriKind.Relative"));
You can display pictures using the Image element:
<Image Source="/MyImage.png" Visibility="Visible"/>
If you want to switch images according to conditions then you can create multiple images and change each of their Visibility states - or (more preferable) you can create a single image element and change its Source.
Quite how you do this depends on whether you are using databinding or working directly with the UIElements in code behind.

Resources