I did this a few times. You just need to read binary safely. Writing can be less safe. Read it exactly into bytes. Yes, doing it all manually is feasible. All it requires is separating the headers from the pixels. Errors will happen because you copy and cut a few bits wrong. You can't rely on ascii reading but you can rely on ascii writing to file. So declare new variable types and sure they are bitwise exact. Reading it all bitwise would probably be easier than passing it into ascii characters.