Reputation: 41
I am trying to compose my colored png with red dots on a grayscale image using Imagemagick, but the result i got is a black and white image with white dots.
I am using this command line:
composite -tile -compose Hardlight red-dots.png image.jpg result.jpg
In Photoshop i can get what i want by changing the image.jpg mode to RVB Colors, and i obtain this:
Below are the samples i am using:
Upvotes: 1
Views: 596
Reputation: 53111
Here is one way to do that in ImageMagick.
Input:
Tile:
Line 1: convert command
Line 2: read the tile, save to MPR, then delete the image (keeping the mpr)
Line 3: read the face image and save to MPR, but keep the image
Line 4: use the image and draw the tile over it to fill the dots out to the size of the image
Line 5: bring the mpr face image back again
Line 6: swap it with the filled out dots image
Line 7: apply headlight composition
Line 8: save the result
convert \
red_dots.png -write mpr:dots +delete \
man_face.jpg -write mpr:face \
-fill mpr:dots -draw 'color 0,0 reset' \
mpr:face \
+swap \
-compose hardlight -composite \
result.png
Result:
An alternate way is as follows:
Line 1: convert command
Line 2: read the face image
Line 3: set the distort viewport to the size of the image
Line 4: read the dots image
Line 5: do a distort with no change of the image orientation or size to tile it out to the size of the face image
Line 6: do hard light composite
Line 7: save the result
convert \
man_face.jpg \
-set option:distort:viewport '%g' \
\( red_dots.png \
-virtual-pixel tile -filter point -distort SRT 0 \) \
-compose hardlight -composite \
result2.png
Upvotes: 2