I change the double chop to a single crop and use repage instead of changing the perspective. I used perspective because first I tried to use page but it doesn't work.
Code: Select all
convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
\( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
-matte +distort Perspective '0,0 62,80 0,1073 62,898 739,1073 628,912 739,0 628,64' \) \
\( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
-matte +distort Perspective '0,0 628,38 0,1073 628,922 81,1073 688,937 81,0 688,31' \) \
\( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
-matte +distort Perspective '0,0 688,31 0,1073 688,937 758,1073 1228,884 758,0 1228,79' \) \
\( label.jpg -resize 510x510\! -repage +1532+229 -gravity West -chop 100x0 \) \
-layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
-alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
-resize 420x253 preview.png
for the -resize I cannot be certain about the size of the input images. Maybe I can dynamically fill the number of the Perspective (I use this in a php script) with the height and width of the input image.
Well for the difference between PNG and JPG, I know JPG doesn't have an alpha channel but that's not the problem. If the input label image isn't already masked if it's a PNG then I have a problem:
That's why I tried to apply a mask on the label before merge, hardlight and copy_opacity but like I said, it didn't work. I also tried with Dst_In instead of Copy_Opacity (and with -matte where it matters) and it didn't work too.
Code: Select all
convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
\( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
-matte +distort Perspective '0,0 62,80 0,1073 62,898 739,1073 628,912 739,0 628,64' \) \
\( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
-matte +distort Perspective '0,0 628,38 0,1073 628,922 81,1073 688,937 81,0 688,31' \) \
\( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
-matte +distort Perspective '0,0 688,31 0,1073 688,937 758,1073 1228,884 758,0 1228,79' \) \
\( \( label.jpg -resize 510x510\! -alpha Off ./label_mask_2.jpg -compose Copy_Opacity -composite \) \
-repage +1532+229 -gravity West -chop 100x0 \) \
-layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
-alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
-resize 420x253 preview.png
Code: Select all
convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
\( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
-matte +distort Perspective '0,0 62,80 0,1073 62,898 739,1073 628,912 739,0 628,64' \) \
\( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
-matte +distort Perspective '0,0 628,38 0,1073 628,922 81,1073 688,937 81,0 688,31' \) \
\( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
-matte +distort Perspective '0,0 688,31 0,1073 688,937 758,1073 1228,884 758,0 1228,79' \) \
\( \( label.jpg -resize 510x510\! -matte ./labelRef.png -compose Dst_In -composite \) \
-repage +1532+229 -gravity West -chop 100x0 \) \
-layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
-matte imandix_label_opacity_2.png -compose Dst_In -composite \) \
-resize 420x253 preview.png
Code: Select all
convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
\( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
-matte +distort Perspective '0,0 62,80 0,1073 62,898 739,1073 628,912 739,0 628,64' \) \
\( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
-matte +distort Perspective '0,0 628,38 0,1073 628,922 81,1073 688,937 81,0 688,31' \) \
\( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
-matte +distort Perspective '0,0 688,31 0,1073 688,937 758,1073 1228,884 758,0 1228,79' \) \
\( \( label.jpg -resize 510x510\! -alpha Off ./label_mask_2.jpg -compose Copy_Opacity -composite \) \
-repage +1532+229 -gravity West -chop 100x0 \) \
-layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
-matte imandix_label_opacity_2.png -compose Dst_In -composite \) \
-resize 420x253 preview.png
Code: Select all
convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
\( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
-matte +distort Perspective '0,0 62,80 0,1073 62,898 739,1073 628,912 739,0 628,64' \) \
\( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
-matte +distort Perspective '0,0 628,38 0,1073 628,922 81,1073 688,937 81,0 688,31' \) \
\( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
-matte +distort Perspective '0,0 688,31 0,1073 688,937 758,1073 1228,884 758,0 1228,79' \) \
\( \( label.jpg -resize 510x510\! -matte ./labelRef.png -compose Dst_In -composite \) \
-repage +1532+229 -gravity West -chop 100x0 \) \
-layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
-alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
-resize 420x253 preview.png
labelRef.png:
imandix_label_opacity_2.png:
I think miss something but I don't see what ^^'
For the black thing, I think it's ok since i use that "-size 1700x1026 xc:black". When I merge the layer before the hardlight the backgound is black. hardLight leave it alone and then CopyOpacity does its work. Actually, the -alpha Off is not mandatory after the hardlight since hardlight is still broken I think and doesn't retain the transparency. I'm wrong ?
ASIDE: Feel free to use any of the images. I post them so it can be useful to others ^^