저녁에 문득 생각나서 ..ㅋㅋ
이미지의 좌표별 색상값을 뽑아 내어 테이블로 똑같은 이미지를 만들수 있지 않을까하는 생각에 시도해보았습니다.
아래 이미지는 결과물입니다.
익스에서는 제대로 된값이 나오질 않더군요..^^
조그만 이미지 도 제대로 값을 출력해내지 못하고 있네요.
아래 이미지는 파폭에서 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개
이미지 복제 시간은 많이 안 걸리나요?
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7630 | 10년 전 | 674 | ||
| 7629 |
|
10년 전 | 2429 | |
| 7628 | 10년 전 | 812 | ||
| 7627 |
|
10년 전 | 1048 | |
| 7626 |
|
10년 전 | 1805 | |
| 7625 | 10년 전 | 740 | ||
| 7624 | 10년 전 | 748 | ||
| 7623 |
|
10년 전 | 3126 | |
| 7622 | 10년 전 | 750 | ||
| 7621 |
leeleeleelee
|
10년 전 | 604 | |
| 7620 | 10년 전 | 555 | ||
| 7619 | 10년 전 | 520 | ||
| 7618 | 10년 전 | 1056 | ||
| 7617 | 10년 전 | 740 | ||
| 7616 | 10년 전 | 675 | ||
| 7615 | 10년 전 | 741 | ||
| 7614 | 10년 전 | 1283 | ||
| 7613 |
|
10년 전 | 2099 | |
| 7612 | 10년 전 | 1181 | ||
| 7611 | 10년 전 | 1446 | ||
| 7610 |
|
10년 전 | 1921 | |
| 7609 |
|
10년 전 | 1375 | |
| 7608 |
mwdkim
|
10년 전 | 1151 | |
| 7607 |
|
10년 전 | 1081 | |
| 7606 |
mwdkim
|
10년 전 | 3956 | |
| 7605 | 10년 전 | 706 | ||
| 7604 | 10년 전 | 1044 | ||
| 7603 | 10년 전 | 1664 | ||
| 7602 |
|
10년 전 | 1097 | |
| 7601 |
AniNest
|
10년 전 | 2811 | |
| 7600 |
port443
|
10년 전 | 1054 | |
| 7599 | 10년 전 | 961 | ||
| 7598 | 10년 전 | 1041 | ||
| 7597 | 10년 전 | 4590 | ||
| 7596 |
SeungYeon
|
10년 전 | 910 | |
| 7595 |
untitled
|
10년 전 | 2459 | |
| 7594 |
프로그래머7
|
10년 전 | 1748 | |
| 7593 |
untitled
|
10년 전 | 2392 | |
| 7592 |
untitled
|
10년 전 | 1957 | |
| 7591 |
untitled
|
10년 전 | 2694 | |
| 7590 |
아리마2001
|
10년 전 | 872 | |
| 7589 | 10년 전 | 1124 | ||
| 7588 |
|
10년 전 | 2939 | |
| 7587 | 10년 전 | 1320 | ||
| 7586 | 10년 전 | 687 | ||
| 7585 | 10년 전 | 1724 | ||
| 7584 | 10년 전 | 1424 | ||
| 7583 |
leeleeleelee
|
10년 전 | 1190 | |
| 7582 |
|
10년 전 | 1151 | |
| 7581 | 10년 전 | 1377 | ||
| 7580 | 10년 전 | 1033 | ||
| 7579 |
|
10년 전 | 622 | |
| 7578 | 10년 전 | 1444 | ||
| 7577 |
|
10년 전 | 1890 | |
| 7576 | 10년 전 | 1401 | ||
| 7575 |
멋진남자임
|
10년 전 | 1481 | |
| 7574 | 10년 전 | 2145 | ||
| 7573 | 10년 전 | 3279 | ||
| 7572 | 10년 전 | 778 | ||
| 7571 |
|
10년 전 | 797 | |
| 7570 |
|
10년 전 | 1340 | |
| 7569 | 10년 전 | 1567 | ||
| 7568 |
this1mg
|
10년 전 | 1065 | |
| 7567 |
|
10년 전 | 785 | |
| 7566 | 10년 전 | 930 | ||
| 7565 |
Angel하늘
|
10년 전 | 1033 | |
| 7564 |
seoldi
|
10년 전 | 1279 | |
| 7563 |
|
10년 전 | 1418 | |
| 7562 |
멋진남자임
|
10년 전 | 2117 | |
| 7561 | 10년 전 | 739 | ||
| 7560 |
leeleeleelee
|
10년 전 | 934 | |
| 7559 | 10년 전 | 5072 | ||
| 7558 |
RinaP
|
10년 전 | 812 | |
| 7557 |
|
10년 전 | 1272 | |
| 7556 | 10년 전 | 1213 | ||
| 7555 |
hyohyojj1234
|
10년 전 | 1681 | |
| 7554 | 10년 전 | 1109 | ||
| 7553 |
senseme
|
10년 전 | 1360 | |
| 7552 |
ehdltdoit
|
10년 전 | 1456 | |
| 7551 |
|
10년 전 | 1846 | |
| 7550 |
leeleeleelee
|
10년 전 | 1617 | |
| 7549 | 10년 전 | 2448 | ||
| 7548 | 10년 전 | 1856 | ||
| 7547 |
멋진남자임
|
10년 전 | 1979 | |
| 7546 | 10년 전 | 1022 | ||
| 7545 |
ILMare1003
|
10년 전 | 1314 | |
| 7544 |
|
10년 전 | 1268 | |
| 7543 | 10년 전 | 903 | ||
| 7542 | 10년 전 | 682 | ||
| 7541 |
울라라라우
|
10년 전 | 885 | |
| 7540 | 10년 전 | 1608 | ||
| 7539 | 10년 전 | 958 | ||
| 7538 |
|
10년 전 | 1846 | |
| 7537 | 10년 전 | 3632 | ||
| 7536 |
Gaumi
|
10년 전 | 1443 | |
| 7535 |
프로그램은어려워
|
10년 전 | 1299 | |
| 7534 |
senseme
|
10년 전 | 1219 | |
| 7533 | 10년 전 | 1223 | ||
| 7532 | 10년 전 | 890 | ||
| 7531 | 10년 전 | 2080 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기