Clint C.
Clint C.

Reputation: 688

php imagick change all non-transparent pixels to a certain color

I am wanting to do the following with imagick via php. My ultimate goal is to create an "outline shadow" of an uploaded image. Then make the image itself transparent while keeping the shadow.

Is this how it could work?

  1. User uploads and image with transparent background.
  2. Use imagick to covert all non transparent pixels to a certain color #cccccc for example.
  3. Use imagick to add a drop shadow.
  4. Remove #cccccc pixels while keeping shadow

Upvotes: 0

Views: 891

Answers (1)

Izzy
Izzy

Reputation: 214

You can create an outline simply by creating a copy of non-transparent pixels, flood-filling them, fuzzing them a bit and then adding this as background.

There is a comprehensive explanation on how to achieve this and how it works in the ImageMagick forums

Upvotes: 2

Related Questions