I have a tiled image, size counting in 100 millions pixels.
Similar to this (684 KB extract), except cleaner.
I want to search-and-replace some tiles.
Like this one.
IM can very probably do that, but how ?
Things to know :
- All tiles are aligned on a 16×16 grid with no offset, and size 16×16 or some small multiple.
- Pixel content matches exactly.
- Searched tile may have binary alpha.
- Replacement tile can be just a solid color, as long as it's unique per tile searched.
- Maybe I can scale the source images down, but not much.
- Resulting image may be scaled down to 1/8.
- I am using the latest IM on Windows 7 x64.
Reading the doc I see...
IM can extract a coordinate list :
But this may be very slow. visgrep might be a fast alternative, but it's for Linux.compare -subimage-search -metric AE \
haystack.png needle.png miff:- 2>/dev/null |
convert - -delete 0 txt:- | sed -n '/#FFFFFF/s/:.*//p'
IM can easily replace a tile :
But can it read and process above coordinate list ?composite -geometry +32+64 replace.png big.png \
result.png
Can these operations be chained ?
Can all search-and-replaces be done in one pass ?