imagesource

How to correctly use the Image Source property with Xamarin.Forms?

北城以北 提交于 2019-12-30 00:50:08
问题 I am having difficulty bringing up an image on the content page in a stack layout. I looked through Xamarin API Documentation and found Xamarin.Forms.Image.Source Property, but no sample code to see how it's written. I also checked to see how it was written in C# and seems to match my code in terms of filename path, but in Xamarin, it may be slightly different since it's the first time doing this. The code I'm currently testing through an Android emulator (Google Nexus 5) in Visual Studio

How to convert ImageSource to Bitmap for cross-platform project(xamarin)

本小妞迷上赌 提交于 2019-12-25 02:56:29
问题 I found an example, but this example use a "Int32Rect", class of System.Windows, we can't use this library for android or ios For bitmap, i use the System.Drawing.Common public static System.Drawing.Bitmap BitmapSourceToBitmap2(BitmapSource srs) { int width = srs.PixelWidth; int height = srs.PixelHeight; int stride = width * ((srs.Format.BitsPerPixel + 7) / 8); IntPtr ptr = IntPtr.Zero; try { ptr = Marshal.AllocHGlobal(height * stride); srs.CopyPixels(new Int32Rect(0, 0, width, height), ptr,

Setting Image source programatically in Metro app, Image doesn't appear

☆樱花仙子☆ 提交于 2019-12-23 15:42:13
问题 I have a main page and a camera page in my application. The main page has an image that does not have its source set and a button. If you click the button, it will take you to the camera page. On the camera page, I capture an image and save it in the pictures library on the tablet and then navigate back to the main page where I would like to set the source of the image to the image I just captured and saved in my pictures library. Here is my relevant code. MainPage.xaml <Image x:Name=

Retrieve image from FTP to webpage

天大地大妈咪最大 提交于 2019-12-23 03:21:27
问题 I have a folder in my ftp server which contains several images. I'm trying to access and show these images in a webpage like <img src="ftp://my_ftp_ip_address/Images/imagename.jpg"/> But it asks for an FTP username and password. How can I achieve this? Also is it possible to do the same using Java? 回答1: With the latest versions of web browsers (Chrome 59, Firefox 61), you cannot even use ftp:// URL to retrieve an image. And it was never a good solution anyway. The correct solution is to route

Dispose StreamResourceInfo.Stream

蓝咒 提交于 2019-12-22 05:23:31
问题 I use StreamResourceInfo.Stream to get BitmapImage s from resources. Is it correct to Close and Dispose the stream after using it? I ask because in memory profiler, I get an error if I do so. Memory profiler says that a disposed instance has not been GCed. If I look on the web, I only can find this post to this topic. In this post, the responding person says, that it is meaninfull to dispose. However if I look at the circumstances and on the effect, I don't think that this is right. Does

Get default jumbo system icon based on file extension

半腔热情 提交于 2019-12-20 23:26:11
问题 Solved! See EDIT 2 for working code. Based on the code from this site and the comments done by freundblase in the same site, I have the following class to get jumbo default icons based on file extension: // Original bad code removed I'm trying to use the class in the following way: preview.ImageSource = IconManager.GetIcon(".pdf", true); where preview is an ImageBrush object. But I get the following image: Yes, I tried with registered file types like pdf files. What's wrong? TIA - EDIT 1: I

Threading with WPF Images (System.InvalidOperationException)

那年仲夏 提交于 2019-12-20 04:13:09
问题 I'm using a thread to get an image from a website and shoot it back to the parent form (WPF) to display. I ran into an issue and have managed to debug it to this example: public void Watch() { while (true) { Bitmap bmp = new Bitmap(1, 1); BitmapImage bmpImg = new BitmapImage(); this.SetImage(bmp, bmpImg); } } public delegate void SetImageCallback(Bitmap bmp, BitmapImage bmpImg); private void SetImage(Bitmap bmp, BitmapImage bmpImg) { if (!this.imgVideo.Dispatcher.CheckAccess()) {

Display local image in UIImageView

谁说胖子不能爱 提交于 2019-12-18 14:23:53
问题 How do I display an image in the UIImageView component from the hard drive? I have a local folder called "images" and would like to access it via a relative path, since I want to package the images with the app. 回答1: To load image from somewhere on your drive use: UIImage * myImage = [UIImage imageWithContentsOfFile: @"../images/1.png"]; Or add image to the Xcode project and use: UIImage * myImage = [UIImage imageNamed: @"1.png"]; After that add image to imageview: UIImageView * myImageView =

@media queries and image swapping [closed]

℡╲_俬逩灬. 提交于 2019-12-17 10:42:32
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 months ago . I want the image in my site to completely change when the browser is resized. I've been using media-queries, but I can't seem to get it right. Any thoughts/tips? 回答1: In the future please add code you've tried. if it's an image tag you can use a class. Hide the second image on

Python Scrapy: Convert relative paths to absolute paths

自作多情 提交于 2019-12-17 09:35:39
问题 I have amended the code based on solutions offered below by the great folks here; I get the error shown below the code here. from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.utils.response import get_base_url from scrapy.utils.url import urljoin_rfc from dmoz2.items import DmozItem class DmozSpider(BaseSpider): name = "namastecopy2" allowed_domains = ["namastefoods.com"] start_urls = [ "http://www.namastefoods.com/products/cgi-bin/products.cgi