On some systems (in general, DOS and Windows-based systems) binmode() is necessary when you're not working with a text file. For the sake of porta- bility it is a good idea to always use it when appropriate, and to never use it when it isn't appropriate. Also, people can set their I/O to be by default UTF-8 encoded Unicode, not bytes. In other words: regardless of platform, use bin- mode() on binary data, like for example images.