fixed ticket [f9c074e766ade1bd] (pickups should not be infinitely tall) (i hope ;-)
[k8vavoom.git] / utils / dlang / zgrab_save.d
blob0889748a50803ad1441b067719418c5cc2ecacf5
1 import arsd.image;
2 import iv.vfs.io;
5 PNG *loadPng (string fname) {
6 import std.file;
7 return readPng(cast(ubyte[])read(fname));
11 void main (string[] args) {
12 foreach (string fname; args[1..$]) {
13 auto png = loadPng(fname);
14 foreach (ref const cc; png.chunks) {
15 if (cast(const(char)[])cc.type[] == "grAb") {
16 if (cc.payload.length == 0) continue;
17 bool allZero = true;
18 foreach (const ubyte b; cc.payload) if (b != 0) { allZero = false; break; }
19 if (allZero) continue;
20 auto fo = VFile(fname~".grAb", "w");
21 fo.rawWriteExact(cc.payload[]);