저녁에 문득 생각나서 ..ㅋㅋ
이미지의 좌표별 색상값을 뽑아 내어 테이블로 똑같은 이미지를 만들수 있지 않을까하는 생각에 시도해보았습니다.
아래 이미지는 결과물입니다.
익스에서는 제대로 된값이 나오질 않더군요..^^
조그만 이미지 도 제대로 값을 출력해내지 못하고 있네요.
아래 이미지는 파폭에서 600 400 픽셀 이미지로 테스트 한 결과 입니다.
파폭도 완벽하게 출력해내지는 못합니다.
위쪽 파란색 테두리의 이미지가 원본이며 아래 이미지는 테이블로 만들어진 이미지 입니다.
아하 php 쏘스 입니다.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?
$imgdir = "p.jpg"; // 이미지 경로를 적어주시면됩니다.
list($width, $height, $type, $attr) = getimagesize($imgdir); // 이미지 사이즈 및 타입을 구함.
$im = imagecreatefromjpeg($imgdir);
function getimgcolorat($x, $y){
global $type, $im;
$rgb = imagecolorat($im, $x, $y); // 이미지에서 좌표값의 색상을 뽑아온다.
//unset($im);
return dechex($rgb);
unset($rgb);
}
$color = array();
$c = 0;
for($y=0; $y<$height; $y++){
for($x=0; $x<$width; $x++){
$imgcolor = getimgcolorat($x, $y);
$key = $x.$y;
if($data[$imgcolor]){
$sellcolor[$key] = $data[$imgcolor];
}else{
$color[$c] = $imgcolor;
$data[$imgcolor] = $c;
$sellcolor[$key] = $c;
$c++;
}
unset($imgcolor);
}
}
unset($data);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>Untitled Document</title>
<style type="text/css">
<!--
.ts {
width: 1px;
height: 1px;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="10" cellpadding="10">
<tr>
<td bgcolor="#0099FF"><img src="<?=$imgdir?>" width="<?=$width?>" height="<?=$height?>"></td>
</tr>
<tr>
<td>
<table width="<?=$width?>" border="0" cellspacing="0" cellpadding="0">
<?
for($y=0; $y<$height; $y++){
echo "<tr>";
for($x=0; $x<$width; $x++){
$key = $x.$y;
$bgcolor = $color[$sellcolor[$key]];
echo "<td bgcolor=\"#{$bgcolor}\" class=\"ts\"></td>";
}
echo "</tr>";
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
댓글 3개
이미지 복제 시간은 많이 안 걸리나요?
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 130 | 20년 전 | 4012 | ||
| 129 | 20년 전 | 2951 | ||
| 128 | 20년 전 | 3692 | ||
| 127 | 20년 전 | 3533 | ||
| 126 | 20년 전 | 3782 | ||
| 125 | 20년 전 | 8600 | ||
| 124 | 20년 전 | 2606 | ||
| 123 | 20년 전 | 3757 | ||
| 122 | 20년 전 | 3216 | ||
| 121 | 20년 전 | 2618 | ||
| 120 | 20년 전 | 2679 | ||
| 119 | 20년 전 | 2592 | ||
| 118 | 20년 전 | 2867 | ||
| 117 |
|
20년 전 | 3070 | |
| 116 | 20년 전 | 5329 | ||
| 115 | 20년 전 | 3934 | ||
| 114 | 20년 전 | 4980 | ||
| 113 | 20년 전 | 6222 | ||
| 112 | 20년 전 | 7329 | ||
| 111 | 20년 전 | 18439 | ||
| 110 | 20년 전 | 6882 | ||
| 109 | 21년 전 | 2890 | ||
| 108 | 21년 전 | 4146 | ||
| 107 |
prosper
|
21년 전 | 2510 | |
| 106 |
prosper
|
21년 전 | 4327 | |
| 105 |
아우겐나이스
|
21년 전 | 2922 | |
| 104 | 21년 전 | 2273 | ||
| 103 | 21년 전 | 2484 | ||
| 102 | 21년 전 | 2270 | ||
| 101 | 21년 전 | 2586 | ||
| 100 | 21년 전 | 1765 | ||
| 99 | 21년 전 | 1578 | ||
| 98 | 21년 전 | 1624 | ||
| 97 | 21년 전 | 2141 | ||
| 96 | 21년 전 | 1893 | ||
| 95 | 21년 전 | 2389 | ||
| 94 | 21년 전 | 3569 | ||
| 93 | 21년 전 | 1571 | ||
| 92 | 21년 전 | 1767 | ||
| 91 | 21년 전 | 3189 | ||
| 90 | 21년 전 | 2348 | ||
| 89 | 21년 전 | 3186 | ||
| 88 | 21년 전 | 2876 | ||
| 87 | 21년 전 | 3302 | ||
| 86 | 21년 전 | 5149 | ||
| 85 | 21년 전 | 2533 | ||
| 84 | 21년 전 | 4834 | ||
| 83 | 21년 전 | 2514 | ||
| 82 | 21년 전 | 3129 | ||
| 81 | 21년 전 | 7642 | ||
| 80 | 21년 전 | 3839 | ||
| 79 | 21년 전 | 3218 | ||
| 78 | 21년 전 | 4703 | ||
| 77 | 21년 전 | 2911 | ||
| 76 | 21년 전 | 6227 | ||
| 75 | 21년 전 | 4478 | ||
| 74 | 21년 전 | 5792 | ||
| 73 | 21년 전 | 3635 | ||
| 72 | 21년 전 | 5978 | ||
| 71 | 21년 전 | 3126 | ||
| 70 | 21년 전 | 2856 | ||
| 69 | 21년 전 | 2648 | ||
| 68 | 21년 전 | 2454 | ||
| 67 | 21년 전 | 2661 | ||
| 66 | 21년 전 | 2683 | ||
| 65 | 21년 전 | 3794 | ||
| 64 | 21년 전 | 2835 | ||
| 63 | 21년 전 | 2465 | ||
| 62 | 21년 전 | 2275 | ||
| 61 | 21년 전 | 3092 | ||
| 60 | 21년 전 | 3142 | ||
| 59 | 21년 전 | 2527 | ||
| 58 | 21년 전 | 2599 | ||
| 57 | 21년 전 | 2979 | ||
| 56 | 21년 전 | 2340 | ||
| 55 | 21년 전 | 2771 | ||
| 54 | 21년 전 | 2136 | ||
| 53 | 21년 전 | 2363 | ||
| 52 | 21년 전 | 2712 | ||
| 51 |
prosper
|
21년 전 | 2360 | |
| 50 |
prosper
|
21년 전 | 2181 | |
| 49 | 21년 전 | 2193 | ||
| 48 | 21년 전 | 2349 | ||
| 47 | 21년 전 | 1945 | ||
| 46 | 21년 전 | 1934 | ||
| 45 | 21년 전 | 2138 | ||
| 44 | 21년 전 | 2373 | ||
| 43 | 21년 전 | 4587 | ||
| 42 |
prosper
|
21년 전 | 2718 | |
| 41 |
prosper
|
21년 전 | 2118 | |
| 40 | 21년 전 | 2186 | ||
| 39 | 21년 전 | 2157 | ||
| 38 | 21년 전 | 2429 | ||
| 37 | 21년 전 | 2578 | ||
| 36 | 21년 전 | 1785 | ||
| 35 | 21년 전 | 4087 | ||
| 34 | 21년 전 | 3861 | ||
| 33 | 21년 전 | 2999 | ||
| 32 |
prosper
|
21년 전 | 2912 | |
| 31 | 21년 전 | 5299 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기