Extract multiple images from the one source image?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

Code: Select all

<?php
exec("/usr/local/bin/convert earth.jpg -crop 200x200 image-%d.jpg");
?> 
Example
http://www.rubblewebs.co.uk/imagemagick/section.php

Anthony
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

Thats beyond me then Ben !

By the way you have an interesting site, I would have liked to see the damage to your car after the hailstones hit it. Can you do that again and get some pictures of the damge next time :)

Anthony
Iland

Re:

Post by Iland »

Hello! Did you solve this problem? I have the same, and I see only one solution - C++ low level API... Maybe, you solve it simplier?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Extract multiple images from the one source image?

Post by anthony »

Did you try writing multiple images!
See http://www.imagemagick.org/Usage/files/#write

For example...

Code: Select all

   convert sat_image.png \
       \(  +clone  -crop 300x300+100+100\! -write area1.png +delate \) \
       \(  +clone  -crop 300x300+100+200\! -write area2.png +delate \) \
       \(  +clone  -crop 300x300+200+100\! -write area3.png +delate \) \
       \(  +clone  -crop 300x300+200+200\! -write area4.png +delate \) \
       null:
That will output 4 images of overlapping crops. Just adjust the arguments to the areas you want. The '!' in the above is a viewport crop, which if the crop is completely within the original image, does an automatic +repage.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply