Your script works flawlessly. Unfortunately, it is not resistant to resizing of the images, cutting, filtering etc. As soon as the image is modified in any way, the secret message is destroyed. It would be nice to be able to identify a spot within the image which always remains constant.
Take the search machine TinEye for example, they are able to recognize an image even if it was modified a thousand times. This means some characteristics must exist that never vary. In those should secret messages be hidden.