Search code examples
imagemagickimagemagick-convert

ImageMagick engraving effect on glass


I want to add logo on product image with engraving effect.

The original logo is

enter image description here

After adding it on the product it should look like this.

enter image description here

how to do this with imagemagick.


Solution

  • Using this as the trophy:

    enter image description here

    Then something along these lines:

    convert trophy.jpg -gravity center \
       \( G.png -colorspace gray -channel a -evaluate multiply 0.2 -resize 120x120 \) -composite result.png
    

    enter image description here

    So, I am basically loading the trophy, then in some "aside processing" in parentheses, loading the Google logo, converting it to greyscale, reducing the opacity by multiplying it by 0.2, resizing it and compositing it on top of the trophy.


    By the way, if you were using GraphicsMagick, which doesn't have the parentheses I used to make sure I only convert the logo to greyscale and not the trophy, you would do it in a different order. First load the logo and process it (greyscale, resize etc), then load the trophy, then swap the order so the trophy goes to the background, like this:

    gm convert G.png -colorspace gray -resize ... trophy.jpg -swap -composite result.png