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?".
Hi all.
I have many png files which are used as textures in a game and thus have their dimensions in a power of 2, even when the image itself is smaller. Is there a script for $(SUBJ)? All the transparent pixels are 0,0,0,0 RGBA. In the end, I need to convert the line/column numbers to floats between 0 and 1, proportional to texture size:
Please say what version IM you use, on what platform, and link to an example image.
How large are the images?
A possible algorithm is:
1. Extract the alpha. Change non-black to white. Now the image is black and white only, and the task is to find the first and last columns with white pixels.
2. Crop into lines (so we have HH images, each WWx1 pixels), and evaluate-sequence max. Now we have one image, WWx1 pixels, and the task is to find the first and last white pixel.
3. Add a 1-pixel black border.
4. Use "format %@" to find the left-most white pixel, and width to the right-most white pixel.
5. Simple arithmetic converts the previous two numbers into coordinates.
is able to output info on where it would trim the image. I'll see if I can make a shell script to do the work with that. So far it seems to be able to do exactly what I'm looking for, but it turns out the mod I'm trying to fix doesn't have a clean texture image to begin with.