Tag: png

C#MonoGame帮助? (Content.Load (“入侵者”);)

我在MonoGame中使用Open GL制作太空侵略者游戏,我正在尝试加载我添加到Content文件夹的纹理(这是一个名为“Invader”的PNG文件) 我使用的代码是: invader = Content.Load(“Invader”); 但是,当我试图运行它时它说: ContentLoadException未处理 无法将Invader加载为非内容文件!

如何保持png透明度?

我创建了一个函数,允许将上传的透明.png文件插入到SQL Server数据库中,并通过HttpHandler显示在网页上。 虽然这一切都有效,但是当在网页上查看时,png透明度会变为黑色。 有没有办法保持透明度? 这是我从MVC控制器插入数据库的图像服务: public void AddImage(int productId, string caption, byte[] bytesOriginal) { string jpgpattern = “.jpg|.JPG”; string pngpattern = “.png|.PNG”; string pattern = jpgpattern; ImageFormat imgFormat = ImageFormat.Jpeg; if (caption.ToLower().EndsWith(“.png”)) { imgFormat = ImageFormat.Png; pattern = pngpattern; } ProductImage productImage = new ProductImage(); productImage.ProductId = productId; productImage.BytesOriginal = bytesOriginal; productImage.BytesFull = Helpers.ResizeImageFile(bytesOriginal, 600, […]

无论如何使用asp.net mvc从3个图像URL中制作一个图像?

我想构建一个类似于nametest或Meaww的facebook应用程序,几乎成功地将我的API调用到Facebook Graph API并从facebook返回数据。 令我困惑的是上述Web应用程序的UI。 当您在Meaww或Nametests上完成测试时,结果将以图像(Jpeg)格式呈现给用户。 我只是不知道他们如何设法使用所有CSS样式等将HTML转换为动态图像以及它们如何将其作为图像返回给用户? 是否有可能在ASP.NET MVC Too中实施此场景? 如果是的话,我需要提示做一下。 下面是Meaww作为测试结果生成的图像。 编辑:更具体一点……我的控制器中有一个public async Task FB_Analyse()动作,它通过图形API调用从facebook获取数据到facebook,然后将数据值传递给模型,然后结束of Action返回如下视图: public async Task FB_Analyse() { var access_token = HttpContext.Items[“access_token”].ToString(); if (!string.IsNullOrEmpty(access_token)) { var appsecret_proof = access_token.GenerateAppSecretProof(); var fb = new FacebookClient(access_token); #region FacebookUser Name and Picture plus other Info //Get current user’s profile dynamic myInfo = await fb.GetTaskAsync(“me?fields=first_name,last_name,link,locale,email,name,birthday,gender,location,age_range,about”.GraphAPICall(appsecret_proof)); dynamic […]

如何使用C#组合像图层的png图像数组?

我有一个名为的图像数组 image__trans.png 所有这些图像都有透明区域。 这个想法是,当把它们放在一起时,它们将形成一个漂亮的图像。 但我得到了一个奇怪的GDI +相关错误(“GDI +中发生了一般错误”),我一直在发疯。 我现在使用的代码可以看作如下; number_of_photos = 30; Bitmap temp = new Bitmap(“background.png”);//some white background 640×480 pixels temp.Save(“temp.png”, ImageFormat.Png); temp.Dispose(); for (int photo_no = 0; photo_no < number_of_photos; photo_no++) { Bitmap temp1 = new Bitmap("temp.png"); Graphics gra = Graphics.FromImage(temp1); Bitmap new_layer = new Bitmap("image_" + photo_no + "_trans.png"); //the images image__trans.png are […]

转换后的图像不清晰。 wmf到png

我正在尝试使用c#.net将wmf图像文件转换为png格式。 但是,保存的图像不清楚,如下所示 http://sofzh.miximages.com/c%23/ header.DpiY 100)); using(Graphics g = Graphics.FromImage(bitmap)){ g.DrawImage(img, 0, 0); } bitmap.Save(test.png”, ImageFormat.Png); 我怎么能弄清楚?

C#保存巨大的图像

我在尝试使用C#保存大量图像时遇到了困难(我说的是超过一千兆字节)。 基本上我试图在部分中执行此操作 – 我有大约200个位图源,我需要一种方法在将它们编码为.png文件之前或之后将它们组合。 我知道这将需要大量的RAM,除非我以某种方式直接从硬盘驱动器传输数据但我不知道如何做到这一点。 每个位图源都是895×895像素,因此在编码后组合图像似乎并不容易,因为C#不允许您创建大小为13425 x 13425的位图。

图像上的质量损失来自哪里?

在我的Winforms应用程序中,它通过Linq连接到数据库到SQL我将图像(总是* .png)保存到一个如下所示的表: CREATE TABLE [dbo].[Images] ( [Id] INT IDENTITY (1, 1) NOT NULL, [Bild] IMAGE NOT NULL, PRIMARY KEY CLUSTERED ([Id] ASC) ); 在我可以存储图片之前,我必须将其转换为byte[] ,这就是我的工作方式: public static byte[] ImageToByteArray(System.Drawing.Image imageIn) { using (MemoryStream ms = new MemoryStream()) { imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Png); return ms.ToArray(); } } 之后,如果我想将这个相同的图像加载到我的应用程序中的PictureBox,我将使用此方法将其转换回来: public static Image ByteArrayToImage(byte[] byteArrayIn) { using (MemoryStream ms = […]

使用BitmapSource,PngBitmapEncoder / Decoder时,在PNG中保存8位索引数据会改变原始字节

使用BitmapSource和PngBitmapEncoder / Decoder保存和加载PNG时遇到问题。 基本上,我希望能够保存一个源自字节数组的图像,当PNG加载到我的程序中时,重新加载完全相同的字节。 原始数据保存很重要。 同时,我希望PNG使用自定义调色板(256色的索引数组)。 我正在尝试使用自定义索引调色板保存我的8位数据。 原始数据范围为0-255。 调色板可以是“阈值”调色板(例如,0-20是颜色#1,21-50是颜色#2,等等)。 我发现的是,当我保存数据,重新加载并执行CopyPixels以检索“原始”数据时,数据值是根据调色板设置的,而不是原始字节数组值。 有没有办法在PNG中保留原始字节数组, 而不会丢失自定义调色板? 或者有没有不同的方法从BitmapSource检索字节数组? 以下是我的保存例程: // This gets me a custom palette that is an array of 256 colors List colors = PaletteToolsWPF.TranslatePalette(this, false, true); BitmapPalette myPalette = new BitmapPalette(colors); // This retrieves my byte data as an array of dimensions _stride * sizeY byte[] ldata […]

在C#中使用Alpha通道显示PNG

有没有办法在C#应用程序中正确显示带alpha通道的图像(比方说PNG)? 谢谢你的任何建议。 更新: 好的,我的问题有点不高兴。 我想获得alpha通道的真实透明度 – 不填充父母的背景颜色。 在下图中,我们可以看到支持透明度,但是图像下方的按钮部分是不可见的。 是否可以实现图像alpha通道的真实透明度? 图像呈现不完全透明度http://img684.imageshack.us/img684/8804/transpt.jpg

生成透明的PNG c#

我有以下function来生成示例徽标。 我想要做的是返回透明的png或gif而不是白色背景。 我该怎么做? private Bitmap CreateLogo(string subdomain) { Bitmap objBmpImage = new Bitmap(1, 1); int intWidth = 0; int intHeight = 0; Font objFont = new Font(“Arial”, 13, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel); Graphics objGraphics = Graphics.FromImage(objBmpImage); intWidth = (int)objGraphics.MeasureString(subdomain, objFont).Width; intHeight = (int)objGraphics.MeasureString(subdomain, objFont).Height; objBmpImage = new Bitmap(objBmpImage, new Size(intWidth, intHeight)); objGraphics = Graphics.FromImage(objBmpImage); objGraphics.Clear(Color.White); objGraphics.SmoothingMode = […]