L
L
leonard2014-09-10 17:57:44
ImageMagick
leonard, 2014-09-10 17:57:44

How to do partial image resizing in imagemagick?

Hello.
I need to solve the following problem: compress an image around the edges using imagemagick, preferably in one command (should be done on the fly).
Something like this:
285effcaac534e23ada4266a83738799.jpg
(in the photo, the eyes remained in place, and the cheeks became closer to the center)
That is, so that, say, an area of ​​20% at the edges turns into a 2-fold shrink (it can be linear, it can be smooth)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
leonard, 2014-09-11
@leonard

Found the solution myself:

convert test.jpg 
\( +clone -crop 200x1000+0+0 -sample 100x\! +repage \) -geometry +100+0 -composite  
\( +clone -crop 200x1000+800+0 -sample 100x\! +repage \) -geometry +800+0 -composite  
\( +clone -crop 1000x200+0+0 -sample x100\! +repage \) -geometry +0+100 -composite 
test_result.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question