라이브러리

[PHP] Imagick::colorFloodfillImage - 대상과 일치하는 모든 픽셀의 색상 값을 변경합니다.




Imagick::colorFloodfillImage

Imagick::colorFloodfillImage는 PHP의 Imagick 클래스의 메소드 중 하나로, 이미지에 특정 색상으로 채우기 기능을 제공합니다. 이 메소드는 지정된 색상으로 이미지의 특정 영역을 채우는데 사용됩니다.

사용법


Imagick::colorFloodfillImage 메소드는 다음과 같은 형식으로 사용됩니다.

#hostingforum.kr
php

Imagick::colorFloodfillImage($image, $fillColor, $floodFillingBoundary, $floodFillingTolerance)



- `$image`: 채우기를 수행할 이미지 객체
- `$fillColor`: 채우기 색상
- `$floodFillingBoundary`: 채우기 영역의 경계
- `$floodFillingTolerance`: 채우기 영역의 허용 오차

예제


다음 예제는 Imagick::colorFloodfillImage 메소드를 사용하여 이미지에 특정 색상으로 채우기 기능을 사용하는 방법을 보여줍니다.

#hostingforum.kr
php

// 이미지 객체를 생성하고 로드합니다.

$image = new Imagick('example.jpg');

$image->thumbnailImage(800, 600); // 이미지 크기를 조정합니다.



// 채우기 색상과 경계를 지정합니다.

$fillColor = new ImagickPixel('red'); // 채우기 색상은 빨간색입니다.

$floodFillingBoundary = new ImagickDraw(); // 채우기 영역의 경계를 지정합니다.

$floodFillingBoundary->setFillColor($fillColor); // 채우기 색상을 지정합니다.

$floodFillingBoundary->setStrokeColor('black'); // 경계 색상을 지정합니다.

$floodFillingBoundary->setStrokeWidth(2); // 경계 두께를 지정합니다.

$floodFillingBoundary->rectangle(100, 100, 300, 300); // 채우기 영역의 경계를 지정합니다.



// 채우기 메소드를 호출합니다.

$image->colorFloodfillImage(100, 100, 300, 300, $fillColor, 10);



// 이미지 출력합니다.

$image->writeImage('output.jpg');



이 예제에서는 이미지에 빨간색으로 채우기 기능을 사용하여 이미지의 특정 영역을 채우는 방법을 보여줍니다. 채우기 색상, 경계, 허용 오차를 지정할 수 있습니다.

참고


Imagick::colorFloodfillImage 메소드는 이미지의 특정 영역을 채우기 기능을 제공합니다. 이 메소드는 이미지의 크기, 채우기 색상, 경계, 허용 오차를 지정할 수 있습니다. 이 메소드는 이미지 처리에 유용한 기능입니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 491 페이지

검색

게시물 검색