Post Reply 

Can the GIMP break apart a icon sheet?

Jan 19, 2011, 06:55 (This post was last modified: Jan 19, 2011 06:56 by SeanEBlog.)
Post: #1
Can the GIMP break apart a icon sheet?
Now here is the sheet in question.
[Image: muchbetter.png]

Now I've already manually broken apart this image into 256 icons, but that was considerably time consuming. (I also did this with a second sheet with just as many icons.) Now I heard that the GIMP could do this automatically for me. If that is true, then I would like to also now the following.

1: Will png transparency be preserved?
2: Will I be forced to use a base 10 naming convention? Or can I name the rows and columns?
(As in scrollAquamarineRed.png, scrollRedSliver.png, scrollGreenBurgundy etc, etc.)
3: Will I get a copyable text list of all the files generated?

Also no, I didn't know name every scroll, I used a hexadecimal naming convention.
Find all posts by this user
Quote this message in a reply
Jan 19, 2011, 08:10
Post: #2
RE: Can the GIMP break apart a icon sheet?
When you were told that Gimp can do it, you may have been misled into thinking that there is some miracle built-in function or at least a neat trick to do it. Unfortunately not. This requires scripting. If you have some programming experience it's quite easy, otherwise you'll have to find someone to do it for you. As to your questions:

1) yes
2) no, but if you name the file ones by one, doing it by hand isn't going to take much more time. A script could also read a list of color names. If you want the images to be named using an hexadecimal representation of their position (00-00.png to FF-FF.png or somesuch), it's not difficult either.
3) if you use a table file in 2) then the table is your list of files. Otherwise there is a DIR command. Or the script can output the list somewhere.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 19, 2011, 08:34
Post: #3
RE: Can the GIMP break apart a icon sheet?
Hmmm... come to think of it... GIMP isn't the best tool for this. What you want is ImageMagick (http://www.imagemagick.org) which is a set of command-line tools for image manipulation. It is just a matter of using "convert -crop ...." 256 times on your image using a .BAT.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 19, 2011, 17:31
Post: #4
RE: Can the GIMP break apart a icon sheet?
Image magic is indeed the tool. You need one single command:

convert muchbetter.png -crop 32x32! icon%02x.png

This will create 256 files, called iconXY.png where X and Y are the coordinates of the icon in the sheet in hexadecimal, so the top row will generate icon00.png to icon0f.png, the next row icon10.png to icon1f.png nfd the bottom row iconf0.png to iconff.png.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 24, 2011, 02:46
Post: #5
RE: Can the GIMP break apart a icon sheet?
Sorry for taking so long to respond, but thank you for directing me to ImageMagick. It does exactly what I need it do. I've done some playing around and I think I've got all the commands I need to work this.

For decimal output
convert INPUT.png -crop 32x32! OUTPUT%03d.png

For Hexadecimal output
convert INPUT.png -crop 32x32! OUTPUT%02x.png

For changing Directory in MS DOS Prompt
Type cd

For change drive in MS DOS Prompt
Type Drive letter then a colon (E:)

For getting a copyable list.
Type DIR when in output directory, right click and select mark, highlight desired data, hit enter, copy data into notepad.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Issue viewing GIMP-modified picture JuniorPear 1 173 Jul 6, 2017 05:03
Last Post: ythgilb
  GIMP Taking Too Long to Start (Fonts) Seta 2 170 Jun 20, 2017 16:10
Last Post: Seta
  Problem with pressure on gimp (huion h610) protosd3 18 4,812 Jun 8, 2017 19:20
Last Post: John Penfold
Question Gimp 2.8 Startup Keeps Not Responding lolly325 38 21,967 Jun 5, 2017 15:46
Last Post: blighty
  GIMP 2.8 Eyedropper Color Selection Tool Not Working? Upgraded App is Slow?? tootallll 14 8,966 Oct 9, 2014 18:39
Last Post: Graphicman2014

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS