Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • PNG Image masking with rotation and alignment using Imagemagick

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 847
    Comment on it

    We can mask a png image over any other image with rotation and proper alignment. Let say for example, if we need to replace the human face of an image with another face, then we need this type of masking. There are various ways and command within imagemagick but I found this command combination very suitable:

    Main image: myimage.jpeg New face: mask.png rotation angle:15 degree X position: 200px Y position: 100px face width: 40px face height: 50px

    Command:

    convert myimage.jpeg \( mask.png -resize 40x50  -background none -virtual-pixel background +distort SRT 15 \) -geometry +200+100 -composite newimage.jpeg
    

    This command will also remove black background around replaced png. Hope this will help someone.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: