대단할것은 없는 강좌이지만,
제 강좌를 출처를 밝히고 외부로 퍼가는 것은 허용하지만,
다른 강좌의 자료나 책의 자료로 사용되거나 부분적인 인용은 허용하지 않습니다.
제 강좌를 출처를 밝히고 외부로 퍼가는 것은 허용하지만,
다른 강좌의 자료나 책의 자료로 사용되거나 부분적인 인용은 허용하지 않습니다.
강좌는 php 5. 대를 기준으로 하며, 이미지 관련을 다룹니다.
이미지에 글을 쓰거나 이미지를 합치거나 하는 등의 내용을 다루어 볼까 합니다.
나중에는 간단한 짤방 만들기 같은 것도 할수 있지 않을까 싶습니다.
이미지에 글을 쓰거나 이미지를 합치거나 하는 등의 내용을 다루어 볼까 합니다.
나중에는 간단한 짤방 만들기 같은 것도 할수 있지 않을까 싶습니다.
이미지관련 > 이미지에 각종 필터를 적용한 결과
이번 내용은
사진에 여러가지 필터를 적용하고 그 결과를 확인해보는 내용입니다.
예제10 > study10.php
<?php
@error_reporting( E_ALL );
header("Content-Type: text/html; charset=UTF-8");
$filters = Array(
'IMG_FILTER_NEGATE'=>IMG_FILTER_NEGATE,
'IMG_FILTER_GRAYSCALE'=>IMG_FILTER_GRAYSCALE,
'IMG_FILTER_EDGEDETECT'=>IMG_FILTER_EDGEDETECT,
'IMG_FILTER_EMBOSS'=>IMG_FILTER_EMBOSS,
'IMG_FILTER_GAUSSIAN_BLUR'=>IMG_FILTER_GAUSSIAN_BLUR,
'IMG_FILTER_SELECTIVE_BLUR'=>IMG_FILTER_SELECTIVE_BLUR,
'IMG_FILTER_MEAN_REMOVAL'=>IMG_FILTER_MEAN_REMOVAL
);
$filters2 = Array(
'IMG_FILTER_BRIGHTNESS'=>Array(IMG_FILTER_BRIGHTNESS, 20, 40, 60, 80, 100),
'IMG_FILTER_CONTRAST'=>Array(IMG_FILTER_CONTRAST, 20, 40, 60, 80, 100),
'IMG_FILTER_SMOOTH'=>Array(IMG_FILTER_SMOOTH, -8, -6, -4, -2, 2, 4, 6, 8)
);
$args = range(0, 200, 100);
$face_file = 'study10_face.jpg'; // 얼굴 원본 사진
$i = 1;
foreach($filters as $name => $filter){
$im = @imagecreatefromjpeg($face_file);
imagefilter($im, $filter);
imagepng($im , 'temp/study10_' . $i . '.png');
@imagedestroy($im);
?>
필터 : <?php echo $name; ?><br>
<img src="temp/study10_<?php echo $i; ?>.png"><br><br><br>
<?
$i++;
}
foreach($filters2 as $name => $array){
$filter = array_shift($array);
foreach($array as $level) {
$im = @imagecreatefromjpeg($face_file);
imagefilter($im, $filter, $level);
imagepng($im , 'temp/study10_' . $i . '.png');
@imagedestroy($im);
?>
필터 : <?php echo $name; ?> 레벨 : <?php echo $level; ?> <br>
<img src="temp/study10_<?php echo $i; ?>.png"><br><br><br>
<?
$i++;
}
}
$name = 'IMG_FILTER_COLORIZE';
$filter = IMG_FILTER_COLORIZE;
foreach($args as $args1){
foreach($args as $args2){
foreach($args as $args3){
$im = @imagecreatefromjpeg($face_file);
imagefilter($im, $filter, $args1, $args2, $args3);
imagepng($im , 'temp/study10_' . $i . '.png');
@imagedestroy($im);
?>
필터 : <?php echo $name; ?> R : <?php echo $args1; ?> G : <?php echo $args2; ?> B : <?php echo $args3; ?> <br>
<img src="temp/study10_<?php echo $i; ?>.png"><br><br><br>
<?
$i++;
}
}
}
?>
@error_reporting( E_ALL );
header("Content-Type: text/html; charset=UTF-8");
$filters = Array(
'IMG_FILTER_NEGATE'=>IMG_FILTER_NEGATE,
'IMG_FILTER_GRAYSCALE'=>IMG_FILTER_GRAYSCALE,
'IMG_FILTER_EDGEDETECT'=>IMG_FILTER_EDGEDETECT,
'IMG_FILTER_EMBOSS'=>IMG_FILTER_EMBOSS,
'IMG_FILTER_GAUSSIAN_BLUR'=>IMG_FILTER_GAUSSIAN_BLUR,
'IMG_FILTER_SELECTIVE_BLUR'=>IMG_FILTER_SELECTIVE_BLUR,
'IMG_FILTER_MEAN_REMOVAL'=>IMG_FILTER_MEAN_REMOVAL
);
$filters2 = Array(
'IMG_FILTER_BRIGHTNESS'=>Array(IMG_FILTER_BRIGHTNESS, 20, 40, 60, 80, 100),
'IMG_FILTER_CONTRAST'=>Array(IMG_FILTER_CONTRAST, 20, 40, 60, 80, 100),
'IMG_FILTER_SMOOTH'=>Array(IMG_FILTER_SMOOTH, -8, -6, -4, -2, 2, 4, 6, 8)
);
$args = range(0, 200, 100);
$face_file = 'study10_face.jpg'; // 얼굴 원본 사진
$i = 1;
foreach($filters as $name => $filter){
$im = @imagecreatefromjpeg($face_file);
imagefilter($im, $filter);
imagepng($im , 'temp/study10_' . $i . '.png');
@imagedestroy($im);
?>
필터 : <?php echo $name; ?><br>
<img src="temp/study10_<?php echo $i; ?>.png"><br><br><br>
<?
$i++;
}
foreach($filters2 as $name => $array){
$filter = array_shift($array);
foreach($array as $level) {
$im = @imagecreatefromjpeg($face_file);
imagefilter($im, $filter, $level);
imagepng($im , 'temp/study10_' . $i . '.png');
@imagedestroy($im);
?>
필터 : <?php echo $name; ?> 레벨 : <?php echo $level; ?> <br>
<img src="temp/study10_<?php echo $i; ?>.png"><br><br><br>
<?
$i++;
}
}
$name = 'IMG_FILTER_COLORIZE';
$filter = IMG_FILTER_COLORIZE;
foreach($args as $args1){
foreach($args as $args2){
foreach($args as $args3){
$im = @imagecreatefromjpeg($face_file);
imagefilter($im, $filter, $args1, $args2, $args3);
imagepng($im , 'temp/study10_' . $i . '.png');
@imagedestroy($im);
?>
필터 : <?php echo $name; ?> R : <?php echo $args1; ?> G : <?php echo $args2; ?> B : <?php echo $args3; ?> <br>
<img src="temp/study10_<?php echo $i; ?>.png"><br><br><br>
<?
$i++;
}
}
}
?>
특별한 내용은 없습니다.
php 에서 imagefilter 함수를 통해서 적용할수 있는 옵션들을
대부분 적용시켜서 결과값을 확인 한것입니다.
적용하고자 하는 필터에 따라
여러가지 값을 같이 주어야 하는 경우가 있어서 위와 같이 분리하여
쉽게 확인 할수 있도록 한것입니다.
댓글 2개
Terrorboy
11년 전
좋아요!
11년 전
ㅎㅎ 그래 고맙다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6430 | 12년 전 | 963 | ||
| 6429 | 12년 전 | 9095 | ||
| 6428 | 12년 전 | 591 | ||
| 6427 |
제이티37
|
12년 전 | 1564 | |
| 6426 |
프로프리랜서
|
12년 전 | 1144 | |
| 6425 |
프로프리랜서
|
12년 전 | 1602 | |
| 6424 |
프로프리랜서
|
12년 전 | 1802 | |
| 6423 | 12년 전 | 997 | ||
| 6422 |
퍼블리셔지노군
|
12년 전 | 1567 | |
| 6421 | 12년 전 | 2203 | ||
| 6420 |
|
12년 전 | 1333 | |
| 6419 |
|
12년 전 | 1283 | |
| 6418 | 12년 전 | 1180 | ||
| 6417 |
senseme
|
12년 전 | 7416 | |
| 6416 |
senseme
|
12년 전 | 1320 | |
| 6415 |
senseme
|
12년 전 | 1184 | |
| 6414 |
senseme
|
12년 전 | 1959 | |
| 6413 |
senseme
|
12년 전 | 957 | |
| 6412 |
senseme
|
12년 전 | 1481 | |
| 6411 |
senseme
|
12년 전 | 1087 | |
| 6410 |
senseme
|
12년 전 | 1038 | |
| 6409 |
PASKRAN
|
12년 전 | 2812 | |
| 6408 | 12년 전 | 10795 | ||
| 6407 | 12년 전 | 2987 | ||
| 6406 |
프로프리랜서
|
12년 전 | 2824 | |
| 6405 |
프로프리랜서
|
12년 전 | 1364 | |
| 6404 |
프로프리랜서
|
12년 전 | 2720 | |
| 6403 |
프로프리랜서
|
12년 전 | 815 | |
| 6402 |
프로프리랜서
|
12년 전 | 1720 | |
| 6401 |
프로프리랜서
|
12년 전 | 1138 | |
| 6400 |
프로프리랜서
|
12년 전 | 1457 | |
| 6399 |
프로프리랜서
|
12년 전 | 1179 | |
| 6398 |
프로프리랜서
|
12년 전 | 1478 | |
| 6397 |
프로프리랜서
|
12년 전 | 3596 | |
| 6396 | 12년 전 | 1865 | ||
| 6395 | 12년 전 | 914 | ||
| 6394 |
|
12년 전 | 5236 | |
| 6393 |
제이티37
|
12년 전 | 1195 | |
| 6392 |
songsinica
|
12년 전 | 1190 | |
| 6391 |
|
12년 전 | 3364 | |
| 6390 |
|
12년 전 | 1617 | |
| 6389 | 12년 전 | 4853 | ||
| 6388 |
스누피사랑
|
12년 전 | 5429 | |
| 6387 | 12년 전 | 1836 | ||
| 6386 | 12년 전 | 3049 | ||
| 6385 |
희망과열정
|
12년 전 | 922 | |
| 6384 | 12년 전 | 3284 | ||
| 6383 | 12년 전 | 10588 | ||
| 6382 |
|
12년 전 | 5783 | |
| 6381 |
SugarSkull
|
12년 전 | 1020 | |
| 6380 | 12년 전 | 771 | ||
| 6379 |
|
12년 전 | 1974 | |
| 6378 | 12년 전 | 1553 | ||
| 6377 | 12년 전 | 490 | ||
| 6376 |
후라보노보노
|
12년 전 | 1329 | |
| 6375 | 12년 전 | 2860 | ||
| 6374 | 12년 전 | 825 | ||
| 6373 | 12년 전 | 2366 | ||
| 6372 |
takumi22
|
12년 전 | 1237 | |
| 6371 |
개초보제이
|
12년 전 | 770 | |
| 6370 |
고급자가되고
|
12년 전 | 1454 | |
| 6369 | 12년 전 | 875 | ||
| 6368 | 12년 전 | 3175 | ||
| 6367 | 12년 전 | 1870 | ||
| 6366 | 12년 전 | 2872 | ||
| 6365 |
lilyosia
|
12년 전 | 1788 | |
| 6364 | 12년 전 | 1051 | ||
| 6363 | 12년 전 | 1582 | ||
| 6362 | 12년 전 | 2728 | ||
| 6361 | 12년 전 | 2552 | ||
| 6360 | 12년 전 | 998 | ||
| 6359 | 12년 전 | 2099 | ||
| 6358 |
|
12년 전 | 1784 | |
| 6357 |
에헤라디야자진방아를돌려라
|
12년 전 | 775 | |
| 6356 | 12년 전 | 2072 | ||
| 6355 | 12년 전 | 3780 | ||
| 6354 | 12년 전 | 3087 | ||
| 6353 | 12년 전 | 1542 | ||
| 6352 | 12년 전 | 7768 | ||
| 6351 | 12년 전 | 2531 | ||
| 6350 | 12년 전 | 2792 | ||
| 6349 | 12년 전 | 1870 | ||
| 6348 | 12년 전 | 3541 | ||
| 6347 | 12년 전 | 1442 | ||
| 6346 | 12년 전 | 1178 | ||
| 6345 | 12년 전 | 1832 | ||
| 6344 | 12년 전 | 1404 | ||
| 6343 |
프로프리랜서
|
12년 전 | 2058 | |
| 6342 |
프로프리랜서
|
12년 전 | 1373 | |
| 6341 |
프로프리랜서
|
12년 전 | 1810 | |
| 6340 |
프로프리랜서
|
12년 전 | 1890 | |
| 6339 |
프로프리랜서
|
12년 전 | 1328 | |
| 6338 |
프로프리랜서
|
12년 전 | 1565 | |
| 6337 | 12년 전 | 5252 | ||
| 6336 |
프로프리랜서
|
12년 전 | 1624 | |
| 6335 |
프로프리랜서
|
12년 전 | 947 | |
| 6334 |
프로프리랜서
|
12년 전 | 1321 | |
| 6333 |
프로프리랜서
|
12년 전 | 2437 | |
| 6332 | 12년 전 | 1095 | ||
| 6331 |
돗단배123
|
12년 전 | 1415 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기