<?php function relief($im) { $filter=imlib_create_filter(); imlib_filter_set_red ($filter, -1, -1, 0, -1, -1, -1); imlib_filter_set_red ($filter, 0, 0, 0, 1, 1, 1); imlib_filter_set_green($filter, -1, -1, 0, -1, -1, -1); imlib_filter_set_green($filter, 0, 0, 0, 1, 1, 1); imlib_filter_set_blue ($filter, -1, -1, 0, -1, -1, -1); imlib_filter_set_blue ($filter, 0, 0, 0, 1, 1, 1); imlib_filter_constants($filter, 0, 768, 768, 768); imlib_filter_divisors ($filter, 0, 6, 6, 6); imlib_image_filter($im,$filter); imlib_free_filter($filter); } function edge_detect($im) { $filter=imlib_create_filter(); imlib_filter_set($filter, -1, -1, 0, -1, -1, -1); imlib_filter_set($filter, -1, 0, 0, -3, -3, -3); imlib_filter_set($filter, -1, 1, 0, -1, -1, -1); imlib_filter_set($filter, 0, -1, 0, -3, -3, -3); imlib_filter_set($filter, 0, 0, 0, 16, 16, 16); imlib_filter_set($filter, 0, 1, 0, -3, -3, -3); imlib_filter_set($filter, 1, -1, 0, -1, -1, -1); imlib_filter_set($filter, 1, 0, 0, -3, -3, -3); imlib_filter_set($filter, 1, 1, 0, -1, -1, -1); imlib_filter_divisors ($filter, 0, 3, 3, 3); imlib_image_filter($im,$filter); imlib_free_filter($filter); } $im = imlib_load_image('test.jpg'); $w=imlib_image_get_width($im); $h=imlib_image_get_height($im); $im2 = imlib_clone_image($im); edge_detect($im); relief($im2); imlib_blend_image_onto_image($im,$im2,0,$w/2,0,$w/2,$h,$w/2,0,$w/2,$h,0,1,0); Header('Content-type: image/jpeg'); imlib_dump_image($im); imlib_free_image($im); imlib_free_image($im2); ?>