A tool to find rectangular area for color pixels that live in the input .png image.
Depends on libpng, so install it first.
./autogen.sh./configuremake -j4sudo make install
colorrectdump input-image-filepath|--help|--version
Example:
colorrectdump /path/to/my/image.png
it will print out result with 4 numbers onto starndard output in format x-min y-min x-max y-max in which x-min and y-min are the top left corner of the rectangular area. You can further use batch/bash script to do batch process from this output on top.
Example output:
114 144 269 227
this means
x-minis 114y-minis 144x-maxis 269y-maxis 227
you can further calculate width/height from x-max-x-min, and y-max-y-min respectively.
Currently it works only with RGBA .png file format that has transparent pixels. If you input opaque image like grayscale, or RGB format, the output is not defined as well as its behavior. This feature will be considered to add later.