2011-10-04 8 views
1

포토샵은 강력한 앤티 앨리어스 텍스트 효과가 있습니다.이미지에 안티 앨리어스 텍스트

imagemagick에는 앤티 앨리어싱 옵션이 있지만. 하지만 포토샵과 같은 앤티 앨리어싱 유형은 없습니다.

거기에 imagemagick과 유사한 강력한 앤티 앨리어스 텍스트 효과를 얻을 수있는 방법이 있습니까?

+0

* 많은 포토샵 텍스트 앤티 앨리어스 유형 중 하나를 참조하고 있습니까? 지금까지 뭐 했니? – hakre

+0

이 페이지에서 설명하는 앤티 앨리어싱 설정을 참조하고 있습니다. http://tutorialblog.org/photoshop-which-anti-alias-setting-is-best/ – pragnesh

+0

예제에는 여러 개가 있습니다. 예를 들어 첫 번째 변형은 imagemagick을 사용하여 상자에서 지원해야하지만, 찾고있는 변형이 아닌 것으로 가정합니다 (none 변형). – hakre

답변

0

완벽한 솔루션은 아닙니다. 나는이 사실을 직접 배우고 있습니다. 그러나 당신에게 가까이 다가 갈 것입니다. 텍스트를 크게 인쇄하고 선택한 크기로 획을 추가 한 다음 축소하십시오. 예제 코드 :

$template_file= "blank.png"; // a transparent png 
$template_blob = file_get_contents($template_file); 
$width = 100; 
$height = 50; 
$mult = 6; 
$template = new imagick(); 
$template->readImageBlob($template_blob); 
$template->setImageDepth(8); 
$template->setCompressionQuality(100); 
$template->setCompression(Imagick::COMPRESSION_NO); 
$template->setImageFormat("png"); 


$points = array( 
    $mult, //scale by which you enlarge it 
    0 //# rotate 
); 

$template->distortImage(imagick::DISTORTION_SCALEROTATETRANSLATE, $points, TRUE); 

$color = '#000000'; 

$draw = new ImagickDraw(); 
$pixel = new ImagickPixel('none'); 
$draw->setFont('Arial.ttf'); 
$draw->setFontSize($font_size*$mult); 
$draw->setFillColor($color); 
$draw->setStrokeColor($color); 
$draw->setStrokeWidth(1); 
$draw->setStrokeAntialias(true); 
$draw->setTextAntialias(true); 
$draw->settextkerning($mult); // adjust the kerning if you like 

$template->annotateImage($draw, $x_indent, $y_indent, $some_angle, $text); 

$points = array( 
    1/$mult, // set it back to the original scale 
    0 // rotate 
); 

$template->distortImage(imagick::DISTORTION_SCALEROTATETRANSLATE, $points, TRUE); 

//Do something with the $template here like: 
$template->writeImage("test.png"); 

$template->clear(); 
$template->destroy(); 
$draw->clear(); 
$draw->destroy(); 
관련 문제