저녁에 문득 생각나서 ..ㅋㅋ
이미지의 좌표별 색상값을 뽑아 내어 테이블로 똑같은 이미지를 만들수 있지 않을까하는 생각에 시도해보았습니다.
아래 이미지는 결과물입니다.
익스에서는 제대로 된값이 나오질 않더군요..^^
조그만 이미지 도 제대로 값을 출력해내지 못하고 있네요.
아래 이미지는 파폭에서 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개
이미지 복제 시간은 많이 안 걸리나요?
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 10년 전 | 454 | ||
| 7829 |
|
10년 전 | 641 | |
| 7828 | 10년 전 | 564 | ||
| 7827 | 10년 전 | 461 | ||
| 7826 | 10년 전 | 479 | ||
| 7825 | 10년 전 | 517 | ||
| 7824 | 10년 전 | 480 | ||
| 7823 | 10년 전 | 423 | ||
| 7822 | 10년 전 | 395 | ||
| 7821 | 10년 전 | 341 | ||
| 7820 | 10년 전 | 364 | ||
| 7819 |
|
10년 전 | 765 | |
| 7818 | 10년 전 | 419 | ||
| 7817 | 10년 전 | 585 | ||
| 7816 | 10년 전 | 439 | ||
| 7815 | 10년 전 | 632 | ||
| 7814 | 10년 전 | 472 | ||
| 7813 | 10년 전 | 430 | ||
| 7812 | 10년 전 | 437 | ||
| 7811 | 10년 전 | 417 | ||
| 7810 | 10년 전 | 613 | ||
| 7809 | 10년 전 | 548 | ||
| 7808 | 10년 전 | 422 | ||
| 7807 | 10년 전 | 438 | ||
| 7806 |
프로그래머7
|
10년 전 | 1362 | |
| 7805 | 10년 전 | 1303 | ||
| 7804 |
zahir1312
|
10년 전 | 802 | |
| 7803 |
|
10년 전 | 1401 | |
| 7802 | 10년 전 | 500 | ||
| 7801 | 10년 전 | 882 | ||
| 7800 | 10년 전 | 1109 | ||
| 7799 | 10년 전 | 587 | ||
| 7798 | 10년 전 | 539 | ||
| 7797 | 10년 전 | 559 | ||
| 7796 | 10년 전 | 391 | ||
| 7795 | 10년 전 | 544 | ||
| 7794 | 10년 전 | 586 | ||
| 7793 | 10년 전 | 1085 | ||
| 7792 | 10년 전 | 509 | ||
| 7791 | 10년 전 | 597 | ||
| 7790 | 10년 전 | 528 | ||
| 7789 |
fbastore
|
10년 전 | 1480 | |
| 7788 | 10년 전 | 582 | ||
| 7787 | 10년 전 | 439 | ||
| 7786 | 10년 전 | 648 | ||
| 7785 | 10년 전 | 621 | ||
| 7784 | 10년 전 | 682 | ||
| 7783 | 10년 전 | 502 | ||
| 7782 | 10년 전 | 528 | ||
| 7781 | 10년 전 | 934 | ||
| 7780 | 10년 전 | 845 | ||
| 7779 | 10년 전 | 798 | ||
| 7778 | 10년 전 | 384 | ||
| 7777 | 10년 전 | 498 | ||
| 7776 | 10년 전 | 491 | ||
| 7775 | 10년 전 | 431 | ||
| 7774 | 10년 전 | 646 | ||
| 7773 | 10년 전 | 400 | ||
| 7772 | 10년 전 | 771 | ||
| 7771 | 10년 전 | 428 | ||
| 7770 | 10년 전 | 671 | ||
| 7769 | 10년 전 | 430 | ||
| 7768 | 10년 전 | 649 | ||
| 7767 | 10년 전 | 1204 | ||
| 7766 | 10년 전 | 529 | ||
| 7765 | 10년 전 | 589 | ||
| 7764 |
잘살아보자
|
10년 전 | 438 | |
| 7763 |
|
10년 전 | 1492 | |
| 7762 |
Tosea
|
10년 전 | 1087 | |
| 7761 | 10년 전 | 686 | ||
| 7760 |
잘살아보자
|
10년 전 | 744 | |
| 7759 |
잘살아보자
|
10년 전 | 584 | |
| 7758 |
잘살아보자
|
10년 전 | 637 | |
| 7757 | 10년 전 | 1275 | ||
| 7756 |
ITBANK
|
10년 전 | 1285 | |
| 7755 | 10년 전 | 1942 | ||
| 7754 | 10년 전 | 1097 | ||
| 7753 | 10년 전 | 916 | ||
| 7752 | 10년 전 | 1418 | ||
| 7751 |
잘살아보자
|
10년 전 | 576 | |
| 7750 |
잘살아보자
|
10년 전 | 505 | |
| 7749 |
잘살아보자
|
10년 전 | 524 | |
| 7748 |
잘살아보자
|
10년 전 | 545 | |
| 7747 |
잘살아보자
|
10년 전 | 623 | |
| 7746 |
잘살아보자
|
10년 전 | 697 | |
| 7745 |
잘살아보자
|
10년 전 | 943 | |
| 7744 |
잘살아보자
|
10년 전 | 438 | |
| 7743 | 10년 전 | 966 | ||
| 7742 |
starbros
|
10년 전 | 862 | |
| 7741 |
잘살아보자
|
10년 전 | 701 | |
| 7740 |
잘살아보자
|
10년 전 | 591 | |
| 7739 |
잘살아보자
|
10년 전 | 485 | |
| 7738 |
잘살아보자
|
10년 전 | 561 | |
| 7737 |
잘살아보자
|
10년 전 | 540 | |
| 7736 |
잘살아보자
|
10년 전 | 560 | |
| 7735 |
잘살아보자
|
10년 전 | 892 | |
| 7734 |
잘살아보자
|
10년 전 | 452 | |
| 7733 |
잘살아보자
|
10년 전 | 564 | |
| 7732 |
잘살아보자
|
10년 전 | 728 | |
| 7731 |
잘살아보자
|
10년 전 | 651 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기