저녁에 문득 생각나서 ..ㅋㅋ
이미지의 좌표별 색상값을 뽑아 내어 테이블로 똑같은 이미지를 만들수 있지 않을까하는 생각에 시도해보았습니다.
아래 이미지는 결과물입니다.
익스에서는 제대로 된값이 나오질 않더군요..^^
조그만 이미지 도 제대로 값을 출력해내지 못하고 있네요.
아래 이미지는 파폭에서 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개
이미지 복제 시간은 많이 안 걸리나요?
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7730 | 10년 전 | 1313 | ||
| 7729 | 10년 전 | 1167 | ||
| 7728 |
잘살아보자
|
10년 전 | 612 | |
| 7727 |
잘살아보자
|
10년 전 | 509 | |
| 7726 |
잘살아보자
|
10년 전 | 841 | |
| 7725 |
잘살아보자
|
10년 전 | 567 | |
| 7724 |
잘살아보자
|
10년 전 | 481 | |
| 7723 |
잘살아보자
|
10년 전 | 546 | |
| 7722 |
잘살아보자
|
10년 전 | 484 | |
| 7721 |
잘살아보자
|
10년 전 | 517 | |
| 7720 |
잘살아보자
|
10년 전 | 482 | |
| 7719 |
비긴어게인
|
10년 전 | 700 | |
| 7718 |
|
10년 전 | 2547 | |
| 7717 |
잘살아보자
|
10년 전 | 664 | |
| 7716 |
잘살아보자
|
10년 전 | 411 | |
| 7715 |
잘살아보자
|
10년 전 | 442 | |
| 7714 |
잘살아보자
|
10년 전 | 505 | |
| 7713 | 10년 전 | 1790 | ||
| 7712 | 10년 전 | 1728 | ||
| 7711 | 10년 전 | 1113 | ||
| 7710 | 10년 전 | 1408 | ||
| 7709 | 10년 전 | 1527 | ||
| 7708 | 10년 전 | 1467 | ||
| 7707 | 10년 전 | 865 | ||
| 7706 |
별지기천사
|
10년 전 | 580 | |
| 7705 | 10년 전 | 1084 | ||
| 7704 |
ICONdesignstudio
|
10년 전 | 636 | |
| 7703 | 10년 전 | 602 | ||
| 7702 |
|
10년 전 | 739 | |
| 7701 | 10년 전 | 1429 | ||
| 7700 | 10년 전 | 1116 | ||
| 7699 | 10년 전 | 586 | ||
| 7698 | 10년 전 | 1155 | ||
| 7697 | 10년 전 | 5180 | ||
| 7696 | 10년 전 | 669 | ||
| 7695 | 10년 전 | 1697 | ||
| 7694 | 10년 전 | 1075 | ||
| 7693 | 10년 전 | 1563 | ||
| 7692 | 10년 전 | 1309 | ||
| 7691 | 10년 전 | 836 | ||
| 7690 | 10년 전 | 1397 | ||
| 7689 | 10년 전 | 1025 | ||
| 7688 | 10년 전 | 628 | ||
| 7687 |
파랑새1597
|
10년 전 | 607 | |
| 7686 | 10년 전 | 863 | ||
| 7685 | 10년 전 | 1351 | ||
| 7684 | 10년 전 | 809 | ||
| 7683 | 10년 전 | 1115 | ||
| 7682 | 10년 전 | 1035 | ||
| 7681 | 10년 전 | 680 | ||
| 7680 | 10년 전 | 997 | ||
| 7679 | 10년 전 | 520 | ||
| 7678 | 10년 전 | 749 | ||
| 7677 | 10년 전 | 649 | ||
| 7676 |
|
10년 전 | 956 | |
| 7675 |
|
10년 전 | 1185 | |
| 7674 | 10년 전 | 1056 | ||
| 7673 | 10년 전 | 761 | ||
| 7672 | 10년 전 | 1102 | ||
| 7671 | 10년 전 | 911 | ||
| 7670 | 10년 전 | 675 | ||
| 7669 |
mashmellow
|
10년 전 | 1239 | |
| 7668 | 10년 전 | 726 | ||
| 7667 | 10년 전 | 1024 | ||
| 7666 |
senseme
|
10년 전 | 667 | |
| 7665 | 10년 전 | 522 | ||
| 7664 | 10년 전 | 1907 | ||
| 7663 |
mixx애교
|
10년 전 | 987 | |
| 7662 | 10년 전 | 1055 | ||
| 7661 |
hkhkah
|
10년 전 | 801 | |
| 7660 | 10년 전 | 1076 | ||
| 7659 |
커네드커네드
|
10년 전 | 943 | |
| 7658 |
바람돌이팡
|
10년 전 | 686 | |
| 7657 | 10년 전 | 1175 | ||
| 7656 | 10년 전 | 1587 | ||
| 7655 | 10년 전 | 1005 | ||
| 7654 |
개발짜증나
|
10년 전 | 866 | |
| 7653 |
네이비칼라
|
10년 전 | 888 | |
| 7652 |
밥먹고합시다
|
10년 전 | 816 | |
| 7651 |
플라이SINJI
|
10년 전 | 1519 | |
| 7650 |
개발짜증나
|
10년 전 | 1429 | |
| 7649 | 10년 전 | 458 | ||
| 7648 |
이미영ㅇㅇ
|
10년 전 | 876 | |
| 7647 | 10년 전 | 451 | ||
| 7646 | 10년 전 | 822 | ||
| 7645 | 10년 전 | 2331 | ||
| 7644 | 10년 전 | 826 | ||
| 7643 |
|
10년 전 | 2877 | |
| 7642 | 10년 전 | 1521 | ||
| 7641 | 10년 전 | 1149 | ||
| 7640 |
개발짜증나
|
10년 전 | 479 | |
| 7639 |
|
10년 전 | 822 | |
| 7638 |
개발짜증나
|
10년 전 | 1143 | |
| 7637 | 10년 전 | 1559 | ||
| 7636 | 10년 전 | 2920 | ||
| 7635 | 10년 전 | 1709 | ||
| 7634 | 10년 전 | 1896 | ||
| 7633 | 10년 전 | 2353 | ||
| 7632 | 10년 전 | 3960 | ||
| 7631 |
|
10년 전 | 1550 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기