Tag: image

正则表达式解析图像数据URI

如果我有 : 如何将数据部分解析为: Mime类型(图像/ gif) 编码(base64) 图像数据(二进制数据)

如何使用winforms从网上下载显示下载进度的图像?

我使用WebRequest以这种方式异步下载URL中的图像: public void Download(string url) { byte[] buffer = new byte[0x1000]; WebRequest request = HttpWebRequest.Create(url); request.Method = “GET”; request.ContentType = “image/gif”; request.BeginGetResponse(result => { WebRequest webRequest = result.AsyncState as WebRequest; WebResponse response = webRequest.EndGetResponse(result); ReadState readState = new ReadState() { Response = response.GetResponseStream(), AccumulatedResponse = new MemoryStream(), Buffer = buffer, }; readState.Response.BeginRead(buffer, 0, readState.Buffer.Length, ReadCallback, […]

在ListView上添加“加载”-image

我想在所有项目加载时添加“加载” – 我的ListView顶部的Image ,如果有很多项目被加载,我仍然需要一个很好的用户体验。 因此,我想要一个浮动Image (动画GIF?)在我的ListView 。 如何解决这个问题,一旦你有浮动图像或控制,你如何使GIF动画?

图像缩放图片框

我在C#中出现图像缩放问题。 我有一个给定尺寸的图片盒:例如宽度= 800px高度= 600px 我正在将不同的图像加载到该图片框中,小图片(400×400)和大图片(800 + x 600+) 如果他们不适合盒子,我的图像会resize。 但它们总是调整为PictureBox的MAX宽度和高度。 因此纵横比被破坏了 。 任何人都可以帮助识别/解决问题吗? 类别: Form1.cs的 ImageHandling.cs (已注释掉) ImageUtilities.cs 例子: 问题1:我的版本 vs原始来源 问题2: 我的版本 vs原始来源 我多么想要它: 解

ASP.Net MVC图像上传通过缩减或填充resize

用户将能够上传图像。 如果图像大于设定尺寸,我想将其缩小到该尺寸。 显然,由于比率,它不必完全匹配,宽度将是键大小,因此高度可变。 如果图像小于设定的尺寸,我想创建一个具有定义颜色背景的设置尺寸的新图像,然后将上传的图像居中,因此结果是带有paddded颜色的原始图像。 任何代码示例或链接都非常感谢

从C#Byte数组加载图像,并使用AngularJS将图像放在html标记中

我正在使用Byte Arrayforms的Image,因为我正在使用以下C#方法转换字节数组 public HttpResponseMessage ReturnBytes(byte[] bytes) { HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new ByteArrayContent(bytes); result.Content.Headers.ContentType = new MediaTypeHeaderValue(“application/octet-stream”); return result; } 我的HTML源代码: var app = angular.module(‘myApp’, []); app.controller(‘myCtrl’, function($scope, $http) { $http.get(“someurl”) .then(function(response) { $scope.imageSrc = response.data; $(‘.div_image’).html(”); }); }); 参考链接我遵循: 如何从C#中的Web Api方法正确获取字节数组? 显示png图像作为对jQuery ajax请求的响应 我无法在HTML视图中加载图像。 请帮助我……

如何将图像添加到标签?

我必须在我的标签上添加图片,但我找不到解决方法如何做到这一点。 我正在尝试使用这个: InitializeComponent(); url = Directory.GetCurrentDirectory() + @”/Cards/cardSkin.png”; mylabel.Background = new ImageBrush(new BitmapImage(new Uri(url))); 我不知道即使我正在使用这个权利,我只是从别人的项目中复制了我们在课堂上所做的事情。 无论如何,我试图创建Image img = Image.FromFile(“YourFile.bmp”); 但我不知道为什么, .FromFile不适合我。 你们中的任何人都有另一种方式将标签作为图片(背景)并帮助新手做到这一点? :d 抛出exception: Error 1 ‘System.Windows.Controls.Image’ does not contain a definition for ‘FromFile.

如何将json图像(byet数组)反序列化为asp.net中的图像?

我的json数组: {” lstFooddtlResult”:[{“class_name”:”Veg”,”food_name”:”pizza”,”food_photo”:[255,216,255,224,0,16,74,70,73,70,0,1……..],”food”:”12″,”qty_uom”:”Pcs”,”unit”:null}]} C#类: public class Food{ public string class_name { get; set; } public string food_name { get; set; } public photo[] photo { get; set; } public int food { get; set; } public string qty_uom { get; set; } public string unitcost { get; set; } } public class photo{ public byte […]

确定文件是否是有效的图像格式

我正在使用C#在Windows中为一个小项目工作,我需要确定文件(没有任何扩展名)是否是有效的图像文件。 是否有任何内置的库函数,以便我可以简化这样做的任务?

我怎样才能清楚地使用DrawString?

我需要使用DrawString方法使用Graphics类绘制一个字符串。 但是图像有一些黑色像素,而不是确切的颜色。 我怎样才能清楚地画出来? public Image Ciz() { Color renk = Color.FromArgb(255, 133, 199); Bitmap result = new Bitmap(KutuBoyutu.Genislik, KutuBoyutu.Yukseklik); result.SetResolution(100, 100); Graphics g = Graphics.FromImage(result); g.SmoothingMode = SmoothingMode.HighQuality; Brush drawBrush = new SolidBrush(renk); StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; Rectangle rect1 = new Rectangle(0, 0, result.Width, result.Height); Font font = […]