Right, this should do it:
#!/bin/bash
# set -x
set -e
_scale=8
while (($#)); do
FILE="$1"
bounds=( $(convert "$FILE" -trim info:- | cut -d ' ' -f 3,4) )
echo "File: " $FILE
echo "Size: " ${bounds[0]}
_new_x=${bounds[0]%%x*}
_new_y=${bounds[0]##*x}
echo "Geometry: " ${bounds[1]}
_orig_x ...
Search found 3 matches
- 2017-05-14T08:18:13-07:00
- Forum: Users
- Topic: Finding first and last line and column with non-transparent pixels?
- Replies: 3
- Views: 3825
- 2017-05-14T07:48:54-07:00
- Forum: Users
- Topic: Finding first and last line and column with non-transparent pixels?
- Replies: 3
- Views: 3825
Re: Finding first and last line and column with non-transparent pixels?
Hi.
Regarding version - 6.9.8-5 from brew (macOS 10.12.4).
I was googling around in the meantime, and convert ... -trim 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 ...
Regarding version - 6.9.8-5 from brew (macOS 10.12.4).
I was googling around in the meantime, and convert ... -trim 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 ...
- 2017-05-14T06:59:49-07:00
- Forum: Users
- Topic: Finding first and last line and column with non-transparent pixels?
- Replies: 3
- Views: 3825
Finding first and last line and column with non-transparent pixels?
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 ...
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 ...