반응형
URL에서 바이트 배열로 이미지
이미지가있는 하이퍼 링크가 있습니다.
해당 하이퍼 링크에서 이미지를 읽고로드하고 byte[]C # 의 바이트 배열 ( )에 할당해야합니다 .
감사.
WebClient.DownloadData 가 가장 쉬운 방법입니다.
var webClient = new WebClient();
byte[] imageBytes = webClient.DownloadData("http://www.google.com/images/logos/ps_logo2.png");
타사 편집 : WebClient는 일회용이므로 다음을 사용해야합니다 using.
string someUrl = "http://www.google.com/images/logos/ps_logo2.png";
using (var webClient = new WebClient()) {
byte[] imageBytes = webClient.DownloadData(someUrl);
}
참고 URL : https://stackoverflow.com/questions/4599686/image-to-byte-array-from-a-url
반응형
'Program Club' 카테고리의 다른 글
| T-SQL을 사용하여 datetime의 시간을 얻습니까? (0) | 2020.12.03 |
|---|---|
| mysql 날짜 시간 비교 (0) | 2020.12.03 |
| Rails 3에서 초기화 프로그램의로드 순서를 어떻게 변경하나요? (0) | 2020.12.03 |
| 왜 "할당되지 않은 로컬 변수 사용"오류를 컴파일합니까? (0) | 2020.12.03 |
| iOS6 viewDidUnload 사용되지 않음 (0) | 2020.12.03 |