PDA

View Full Version : اضافه کردن متن به عکس ها



Mahdad999
دوشنبه 11 خرداد 1388, 11:33 صبح
سلام دوستان،
من میخوام روی عکس یک متن اضافه کنم و اونو با اون متن به عنوان یک عکس جدید ذخیره کنم. لطفا اگه سورسی در این مورد دارید یا کمکی میتونید بکنید ممنون میشم.

rezatati
دوشنبه 11 خرداد 1388, 12:43 عصر
فکر کنم اینو میخواهی

http://www.switchonthecode.com/tutorials/csharp-snippet-tutorial-how-to-draw-text-on-an-image

Mahdad999
دوشنبه 11 خرداد 1388, 20:00 عصر
فکر کنم اینو میخواهی

http://www.switchonthecode.com/tutorials/csharp-snippet-tutorial-how-to-draw-text-on-an-image
ممنون دوست خوبم دقيقا همينه ولي كدي كه نوشته بود جواب نداد، شما خودت تست كردي؟

kiarash_h18
سه شنبه 12 خرداد 1388, 09:46 صبح
سلام دوستان،
من میخوام روی عکس یک متن اضافه کنم و اونو با اون متن به عنوان یک عکس جدید ذخیره کنم. لطفا اگه سورسی در این مورد دارید یا کمکی میتونید بکنید ممنون میشم.

اين كد تست كن اميدوارم كه مشكلت حل بشه.

protected void Page_Load(object sender, EventArgs e)
{
GeneratIMG(Session["path"].ToString(), Request.QueryString["images"].ToString());
}
private void GeneratIMG(string _Path, string _Name)
{
Response.Clear();
System.Drawing.Bitmap bitMapImage = new System.Drawing.Bitmap(_Path + _Name);
System.Drawing.Graphics graphicImage = System.Drawing.Graphics.FromImage(bitMapImage);
System.Drawing.Graphics graphicImage1 = System.Drawing.Graphics.FromImage(bitMapImage);
System.Drawing.Graphics graphicImage2 = System.Drawing.Graphics.FromImage(bitMapImage);
System.Drawing.Graphics graphicImage3 = System.Drawing.Graphics.FromImage(bitMapImage);
System.Drawing.Graphics graphicImage4 = System.Drawing.Graphics.FromImage(bitMapImage);
System.Drawing.Graphics graphicImage5 = System.Drawing.Graphics.FromImage(bitMapImage);
graphicImage.DrawString("------------------Some TEXT----------------", new System.Drawing.Font(System.Drawing.FontFamily.Gene ricSansSerif, 21, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel),
new System.Drawing.SolidBrush(System.Drawing.Color.Fro mArgb(100, System.Drawing.Color.DarkBlue)), new System.Drawing.Point(100, 80));
System.Drawing.Image _Image = System.Drawing.Image.FromFile(Server.MapPath(Reque st.ApplicationPath + @"/images/Body/logo.gif"));
graphicImage5.DrawImage(_Image, new System.Drawing.Point(0, 50));
Response.ContentType = "image/jpeg";
bitMapImage.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
graphicImage.Dispose();
bitMapImage.Dispose();
Response.End();
}
موفق باشيد.
يا حق.