TSHIRT

 Transforms an image to place it in a region of a tshirt image

EXAMPLES

 Example 1 -- Gray Tshirt and Opaque Image Input (Overlay) Image (Source Image) Background (Tshirt )Image (Source Image) Background (Tshirt )Image With Selected Bounding Box Arguments: -r "130x130+275+175" or -c "275,175 404,175 404,304 275,304" Arguments: -r "130x130+275+175" -f crop -g north Arguments: -r "130x130+275+175" -f crop -g center Arguments: -r "130x130+275+175" -f distort Arguments: -r "130x130+275+175" -f top Arguments: -r "130x130+275+175" -R -3 -o 5,0

 Example 2 -- Blue Tshirt and Opaque Image Background (Tshirt )Image (Source Image) Arguments: -r "130x130+275+175"

 Example 3 -- Gray Tshirt and Transparent Image Input (Overlay) Image (Source Image) Background (Tshirt )Image (Source Image) Arguments: -r "130x130+275+175" -R -3 -o 5,0

 Example 4 -- Textured Gray Tshirt and Opaque Image Input (Overlay) Image (Source Image) Background (Tshirt )Image (Source Image) Arguments: -r "190x280+210+160" Arguments: -r "190x280+210+160" -b 3 Arguments: -r "190x280+210+160" -b 3 -l -10 Arguments: -r "190x280+210+160" -b 3 -l -10 -A 5

 Example 5 -- Animations With 2 Images and Different Fits Input (Overlay) Image 1 (Source Image) Input (Overlay) Image 2 (Source Image) Background (Tshirt )Image (Source Image) Background (Tshirt )Image With Selected Bounding Box Arguments: -r "130x130+275+175" -f none Arguments: -r "130x130+275+175" -f crop -g center Arguments: -r "130x130+275+175" -f scale Arguments: -r "130x130+275+175" -f distort

 Example 6 -- Masking Input (Overlay) Background (Tshirt ) Image Background (Tshirt ) Image With Rectangle Mask File Arguments: -r "185x185+170+235" -f crop -g center -l 30 -a 10 -A 2 -b 3

 What the script does is as follows: Converts the image to grayscale Gets the region and computes the grayscale mean and difference from mid gray Adjust the grayscale image so that the region is mid gray Modifies the mid gray image by adjusting the contrast to create the lighting image Blurs the mid gray image to create the displacement image Sharpens and crops the overlay image Uses the bounding coordinates to perspectively adjust the overlay image to the desired size and inserts that into a transparent background image the size of the tshirt image Applies the lighting image to the modified overlay image Applies the displacement image to the lighting adjusted modified overlay image Composites the final overlay image onto the tshirt image