Re: Crop images and composing them

Anthony Thyssen <[email protected]> Mon, 4 Apr 2011 12:54:24 +1000
Newsgroups gmane.comp.video.image-magick.user
Message-ID <20110404125424.15b6ef2b@wraith>
On Fri, 01 Apr 2011 18:05:00 +0200,
[email protected] wrote :
| 
| Dear all,
| I have a question. In CSS file I have this file:
| http://imgby.com/close.png
| 
| is it possible to crop the first button, similar to this CSS command:
| -moz-image-region: rect(0,16,16,0);
| (top, right, bottom, left)
| 
| I want to obtain a 64x16 PNG adding the cropped button as fourth button.
| Thanks
| 
| -moz-image-region
| Sandro
| 
|
I prefer to answer on the IM forum rather than the mail list, so that
people can search and see other peoples answers.  However...

YES
  convert close.png -crop 16x16+0+0 +repage first_button.png

See ImageMagick Exmaples Crop
  http://www.imagemagick.org/Usage/crop/#crop



If you want to append the first button, this may be easier...

  convert close -crop 16x16 +repage \( -clone 0 \) +append new_image.png


This uses Tile crop to separate all the buttons
  http://www.imagemagick.org/Usage/crop/#crop_tile

Duplicates the first button (using a older method)
  http://www.imagemagick.org/Usage/basics/#clone

then appends them together again
  http://www.imagemagick.org/Usage/layers/#append



  Anthony Thyssen ( System Programmer )    <[email protected]>
 --------------------------------------------------------------------------
   Look, you don't have to believe everything you hear about werewolves.
   We're human, just like everyone else. Most of the time.
                                     -- Terry Pratchett, "Men At Arms"
 --------------------------------------------------------------------------
   Anthony's Castle     http://www.ict.griffith.edu.au/anthony/