Could you please
UseCodeTags next time? It makes your code so much easier to read.
By reading it as an image, then storing it as an image again the quality of the image may become less. It's probably better to open a connection to the URL and copy the bytes into the ByteArrayOutputStream directly:
I sugges you give your file a different extension. "bat" is used for Windows / DOS batch scripts. "dat" is much more common for binary data files.
This is where you're logic goes wrong. The binary file will contain only 0 and 1 bytes. That's right, bytes. You've essentially made your file up to 8 times as big, as now it uses 1 byte for each bit (ignoring leading zeros).
Usually I'd say to use the original file directly, but you don't want to do this because of security concerns. That means that you have to encrypt the file, then decrypt the file again before you convert the file back to an image. You have a crude way of encrypting, but you don't decrypt it back.
Now you use your own, very simplistic encryption. I would take a look at CipherOutputStream and CipherInputStream instead, with a secure encryption algorithm like AES or Blowfish. The advantage is that it adds even more security (you need a key to decrypt), but it also doesn't make your file up to 8 times as big.
If you still want to use your own encryption technique,
you should improve it. Make sure that each byte is stored in 8 bytes, not make it dependent on the value. So do not use Integer.toBinaryString(by) but use bit-wise operations:
The decrypting, using a DataInputStream wrapped around the InputStream so you can use the readFully method: