怎样将Color转换成Stream

kisstome88 2010-11-03 10:21:21
我想将Color画到图片上,不知道怎样写
Color pColor = Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(168)))), ((int)(((byte)(1)))));

//Image image = Image.FromStream( // .FromFile(@"F:\Picture\139南美洲地形.jpg");
//colorRamp1.Items.Add(image);
...全文
81 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
LorenLiu 2010-11-03
  • 打赏
  • 举报
回复
貌似你要在地图上做标记。试试下面的代码


// Constract the image object
Image image = Image.FromFile(@"F:\Picture\139南美洲地形.jpg");

// Draw a triangle on the specified location of the image
using (Graphics g = Graphics.FromImage(image))
{
using (Pen p = new Pen(Color.FromArgb(192, 168, 1)))
{
g.DrawPolygon(p, new Point[] { new Point(100, 100), new Point(97, 103), new Point(103, 103) });
}
}

// Save the result
image.Save(@"F:\Picture\139南美洲地形-Modified.jpg");


但是你用的Color颜色(192,168,1)太暗了。。看起来不明显,建议你用个显眼一点的颜色比如红色或黄色
边城的刀声 2010-11-03
  • 打赏
  • 举报
回复

Image image = Image.FromStream(File.Open(@"F:\Picture\139南美洲地形.jpg"));
Graphics graphics = Graphics.FromImage(image);
Brush brush = new SolidBrush(Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(168)))), ((int)(((byte)(1))))));
g.FillRectangle(brush,0,0,100,100);
边城的刀声 2010-11-03
  • 打赏
  • 举报
回复
Image image = Image.FromStream(File.Open(@"F:\Picture\139南美洲地形.jpg"));

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧