Page 1 of 1

Convert tall image into a small with effect

Posted: 2013-10-23T21:04:10-07:00
by semptrion
Hi, I have a tall image and I need to convert into a small copyng the top and the base and putting an effect of break image, preserving top and bottom of image.
(Sorry for my English... but an image is like a thousand of words)
Image
Thanks in advance

Re: Convert tall image into a small with effect

Posted: 2013-10-23T21:13:41-07:00
by fmw42
You need to do something like:

1) crop the top and bottom parts (-crop)
2) make a mask with the jagged outline on the top and another for the bottom (-draw)
3) composite each mask with the image with a transparent background (-compose ... -composite)
4) add shadows and possibly transparent borders (-shadow, -splice)
5) append the images (-append)

variations of order and other commands may produce the same kind of results.

see
http://www.imagemagick.org/script/comma ... ptions.php
http://www.imagemagick.org/Usage/


Please identify your version of IM and platform.

If you need further help, please supply a separate image for the input (not a combination of the two in one image)

Re: Convert tall image into a small with effect

Posted: 2013-10-24T08:46:46-07:00
by snibgo
It's an interesting example of combining a number of processes towards a single effect. Here's a Windows script that follows fmw42's steps, though not exactly. It creates sample.png, but this might be a page scan or whatever, then applies the processes, resulting in cutout_shad.png. All the convert commands could be combined into one, without all the intermediate files.

Code: Select all

%IM%convert -size 1000x6000 gradient:red-blue sample.png


%IM%convert ^
  -size 1000x100 xc: ^
  -draw "path 'M0,50 L333,99 L666,0 L999,50 L999,99 L0,99 Z'" ^
  cutout_mask.png

%IM%convert ^
  sample.png ^
  ( -clone 0 -gravity North -crop 1000x200+0+0 +repage -write cutout_Top.png ) ^
  ( -clone 0 -gravity South -crop 1000x200+0+0 +repage -write cutout_Bottom.png ) ^
  NULL:

%IM%convert ^
  cutout_Bottom.png ^
  ( +clone -fill Black -colorize 100 cutout_mask.png -negate -gravity North -composite ) ^
  -alpha off ^
  -compose CopyOpacity -composite ^
  cutout_Bottom_cut.png

%IM%convert ^
  cutout_Top.png ^
  ( +clone -fill White -colorize 100 cutout_mask.png -gravity South -composite ) ^
  -alpha off ^
  -compose CopyOpacity -composite ^
  cutout_Top_cut.png

%IM%convert ^
  cutout_Top_cut.png ^
  ( cutout_Bottom_cut.png -repage +0+150 ) ^
  -background None -layers Merge ^
  cutout.png

%IM%convert ^
  cutout.png ^
  ( +clone -background Black -shadow 80x2+12+12 ) ^
  -background None ^
  +swap -layers Merge +repage ^
  cutout_shad.png