C# :: Code & APIs

[C#] 웹 이미지를 C# 에서 불러오는 함수

WebClient 를 이용해서 웹 상의 이미지를 Bitmap 형식으로 읽고 반환 해 주는 함수입니다.


public Bitmap WebImageView(string URL)

{

	try

	{

		WebClient Downloader = new WebClient();

		Stream ImageStream = Downloader.OpenRead(URL);

		Bitmap DownloadImage = Bitmap.FromStream(ImageStream) as Bitmap;

		return DownloadImage;

	}

	catch (Exception)

	{

		return null;

	}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s