Help Wanted [Solved]

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
VincentAMV
Posts: 2
Joined: 2012-12-07T18:58:35-07:00
Authentication code: 6789

Help Wanted [Solved]

Post by VincentAMV »

Hello people who know how to use ImageMagick. Let it be clear that I am not familiar with any coding but I wanted to cut an image holding about 2500 icons into about 2500 different images holding each icon seperate. It takes too long to select them individually and paste them into paint to save them and I don't have photoshop or similar programs.

I have no clue how to use the program although I figured out the command line I should enter, but I don't know where....
[spoiler]Image[/spoiler]
This image here should be cut into with the line:
convert IconSetAll: -crop 16x213@ +repage +adjoin IconSetCut_16x213@_%d.png
As it's 16 icons wide and 213 icons high (this includes the blank lines)

Is there anyone who can tell me how to use the program to even enter lines or someone willing to do this for me and turn the icons into a .zip or .rar for me?


Any help is appriciated, I hope you will stumble onto this soon.
Vincent

PS: I know this is a copy of the post I made in the Consult Subforum, but I was adviced to place it here as well. If either one is resolved or being resolved I will delete the other to prevent any confusion.
Last edited by VincentAMV on 2012-12-08T13:06:17-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help Wanted

Post by fmw42 »

convert IconSetAll: -crop 16x213@ +repage +adjoin IconSetCut_16x213@_%d.png
This should properly be

convert IconSetAll.png -crop 16x213@ +repage +adjoin IconSetCut_16x213@_%d.png

But it will not likely work well as there is little room between some icons, the icon heights look to vary and the height of the image is not evenly divisible by 213. Furthermore there are groups of icons with different headers and likely different spacing that is not matched to cut into 213 pieces in the height dimension. Each group probably needs to be cropped properly before trying the command above (so that each is evenly divisible in height by the number of icons).
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Help Wanted

Post by snibgo »

With a bit of experimentation, I count 230 rows.

The icons are not in strict columns, so the following nearly works but not quite:

Code: Select all

convert iconAll.png ^
  -bordercolor White -border 1x1 ^
  +repage ^
  -trim ^
  -trim ^
  +repage ^
  -crop 16x230@ ^
  i01_%%04d.png
I hoped that each group might be in strict columns, so it would be a fairly simple task to treat each group separately. Sadly not -- even the first group isn't in columns. Some icons abut others, so automatic separation would be difficult. I reckon it would take a day to go through it, piece by piece.
snibgo's IM pages: im.snibgo.com
VincentAMV
Posts: 2
Joined: 2012-12-07T18:58:35-07:00
Authentication code: 6789

Re: Help Wanted

Post by VincentAMV »

If they aren't properly spaced out evenly then there is nothing to do about it, it would take as much work to edit this to be perfectly even as it would be to cut out every icon from the sheet.
Thank you all for looking at it and responding so quickly.

Vincent.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Help Wanted

Post by snibgo »

I reckon the above command (Windows script) gives about 99% of the icons with no problem. If you can't run the command, send me a PM with your email address and I'll send you the results in a zip file.
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Help Wanted [Solved]

Post by anthony »

You may be able to do it by using a program to seperate (or mask) each unconnected object in the image.

Take a look at Fred Weinhaus's script "multicrop", It may need some tweaking to reduce the 'grid search pattern' it uses in finding objects, but it should do the trick.
http://www.fmwconcepts.com/imagemagick/multicrop/

If each row has a actual gap between them (though I don't think that is the case) then you can use a script 'divide_vert' to try separate each row from each other. It will at a minimum separate each group.
http://www.imagemagick.org/Usage/scripts/divide_vert
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply