Last active
August 28, 2020 21:39
-
-
Save ryanwoodsmall/6f4942fb86e9b53b7d80aeacfe5c18c0 to your computer and use it in GitHub Desktop.
netpbmto.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# show conversions for a (custom built) netpbm | |
# | |
# ex: ./netpbmto.py | egrep "\['png'.*'xpm'\]" | |
# | |
from os import walk | |
import re | |
rs = [] | |
def recfind(k): | |
if not fc[k]: | |
return | |
print(rs) | |
if (k in rs): | |
return | |
else: | |
rs.append(k) | |
for e in fc[k]: | |
recfind(e) | |
rs.remove(k) | |
dir2read = "/home/ryan/Downloads/netpbm/netpbm-10.73.30-built/bin" | |
fl = [] | |
for (dirpath, dirnames, filenames) in walk(dir2read): | |
fl.extend(filenames) | |
fc = {} | |
for f in fl: | |
if (re.search(r".*to.*", f)): | |
(s,d) = f.replace("to","|",1).split("|") | |
try: | |
fc[s].append(d) | |
except KeyError: | |
fc[s] = [d] | |
try: | |
if fc[d]: | |
continue | |
except KeyError: | |
fc[d] = [] | |
for k in fc: | |
#for k in ['png']: | |
#print(k + ": " + str(fc[k])) | |
recfind(k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for i in /tmp/ginaapbo11?.png ; do | |
x=${i//.png/.xpm} | |
echo $i : $x | |
pngtopam < $i | pamtotga | tgatoppm | ppmtoxpm > $x | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment