Current methods of embedding hidden data in an image inevitably distort the original image by noise. This distortion cannot generally be removed completely because of quantization, bit-replacement, or truncation at the grayscales 0 and 255. The distortion, though often small, may make the original image unacceptable for medical applications, or for military and law enforcement applications where an image must be inspected under unusual viewing conditions (e.g., after filtering or extreme zoom). The present invention provides high-capacity embedding of data that is lossless (or distortion-free) because, after embedded information is extracted from a cover image, we revert to an exact copy of the original image before the embedding took place. This new technique is a powerful tool for a variety of tasks, including lossless robust watermarking, lossless authentication with fragile watermarks, and steganalysis. The technique is applicable to raw, uncompressed formats (e.g., BMP, PCX, PGM, RAS, etc.), lossy image formats (JPEG, JPEG2000, wavelet), and palette formats (GIF, PNG).