[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 901- 2chのread.cgiへ]
Update time : 07/02 11:43 / Filesize : 233 KB / Number-of Response : 945
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

ふらっとC#,C♯,C#(初心者用) Part47



844 名前:843 [2009/11/17(火) 22:25:52 ]
//ソース
int pixel = 256;
Bitmap bmp = null;
Graphics g = null;
Rectangle rect;
System.IO.FileInfo fInfo = new System.IO.FileInfo(filePath);
Image origin = Image.FromFile(fInfo.FullName);
int wBlocks = (int)Math.Ceiling((double)origin.Width / (double)pixel);
int hBlocks = (int)Math.Ceiling((double)origin.Height / (double)pixel);
Console.WriteLine(filePath);
for (int h = 0; h < hBlocks; h++)
{
for (int w = 0; w < wBlocks; w++)
{
bmp = new Bitmap(pixel, pixel);
g = Graphics.FromImage(bmp);
rect = new Rectangle((w * pixel), (h * pixel), pixel, pixel);
g.DrawImage(origin, 0, 0, rect, GraphicsUnit.Pixel);
string destName = fInfo.Directory + "\\" + fInfo.Name.Replace(fInfo.Extension, string.Empty) + "_" + h.ToString("000") + "_" + w.ToString("000") + ".png";
bmp.Save(destName, System.Drawing.Imaging.ImageFormat.Png);
g.Dispose();
bmp.Dispose();
}
}
origin.Dispose();






[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧]( ´∀`)<233KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef