The approach is to write a short python script which automates the hex editing necessary and then execute the script on all the cache files. Pretty straight forward. As usual, this only works on Linux and I have no idea about other OSes.
The first step is to find your tec cache files. Plug the phone into a computer and turn on USB storage. Navigate around until you find any tec files, which are cached thumbnails. For me, the path is /sdcard/DCIM/Camera/cache
Once you have the files on your computer in a folder (do not edit the originals on your phone!), you need to open a text editor to create the python script. This script in python is pretty simple:
This file contains 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/python | |
import sys | |
#open the tec file (first command line argument) in binary mode | |
fin = open(sys.argv[1], 'rb') | |
#open the jpg file for output (second command line argument) in binary mode | |
fout = open(sys.argv[2], 'wb') | |
#Read in the file | |
data = fin.read() | |
#The important part: remove the first 8 bytes and remove the last byte | |
fout.write(data[6:-1]) | |
#close the file | |
fin.close() | |
fout.close() |
chmod +x tec2jpg.pyThe final ingredient is to execute the python script on all the tec files in a directory. This can be done using this little bash for loop in the command line when you are in the directory containing the tec files:
for i in `ls *tec`; do NAME=`basename $i .tec`; path/to/python-script/tec2jpg.py $NAME.tec $NAME.jpg; done;That's it! You should at this point have jpegs for all the original tec cached thumbnails. I have only tested this on my Samsung galaxy, so I have no idea if it works on other phones. Best of luck!
No comments:
Post a Comment