The ability of the visual system to detect contrast in an image is a function of the frequency of the contrasting pattern and the distortion of the image. The visual system is more sensitive to contrasting patterns of lower frequency. When the image is significantly distorted, the visual system is even more sensitive to lower frequencies than higher frequencies. An image encoder employs lossy data compression processes producing a distorted reconstructed image. A method of quantizing image data including the step of varying the magnitude of a quantization step as a function of the distortion of an image is disclosed for further visually optimizing image quantization. Another method utilizes distortion adaptive weighting to vary the limit of code block truncation during embedded bitstream coding to visually optimize image compression by increasing relative lossiness of compression at higher frequencies.