PDA

View Full Version : کار با تصاویر



مهدی رحیم زاده
یک شنبه 21 بهمن 1386, 20:54 عصر
1- میخوام اندازه یک عکس رو تغییر بدم و اونو به اندازه استاندارد سایت برسونم ، برای اینک کار باید چکار کار کنم ؟منظورم اینه که وقتی اندازه عکس بزرگتر از حد استاندارد بود اونو کوچیک کنمش /.
2- چطور میشه یک عکس رو به تعداد مساوی قطعات کوچکتر برش داد . یعنی یک عکس رو مثلا به شش قسمت مساوی تقسیم کرد و برید .

raravaice
یک شنبه 21 بهمن 1386, 21:08 عصر
1.


Dim w, h, dpi_w, dpi_h As Integer

imh = dra.FromStream(File1.PostedFile.InputStream())
dra = imh.FromStream(File1.PostedFile.InputStream())
w = imh.Size.Width
h = imh.Size.Height

Dim w1 As Integer
Dim h1 As Integer

w1 = 150

h1 = 100

Dim NewImage As System.Drawing.Image = New System.Drawing.Bitmap(w1, h1)
Dim NewImageGraphics As Graphics = Graphics.FromImage(NewImage)
Dim DistRectangle As Rectangle = New Rectangle(0, 0, NewImage.Width, NewImage.Height)
Dim SourRectangle As Rectangle = New Rectangle(0, 0, dra.Width, dra.Height)
NewImageGraphics.DrawImage(dra, DistRectangle, SourRectangle, GraphicsUnit.Pixel)
NewImage.Save(Server.MapPath("..\hotel_image\") & pic_name & "\hotel.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)



2. نمی دونم ;)