This paper proposes a method of encoding images in a visually lossless manner using adaptive visibility thresholds and visual masking effects within the framework of JPEG2000. Our adaptive visibility thresholds (VTs) are determined through psychophysical experiments for measuring quantization distortion models, which are based on the variance of wavelet coefficients and the characteristics of the deadzone quantizer of JPEG2000. These VTs are further adjusted using visual masking effects present in the background image where distortion appears, and are used to determine the quantization level in the embedded bit-plane coder for visually lossless coding. The proposed method modifies the distortion calculation and codestream generation stages in the encoder and the resulting codestreams are fully compatible with Part-I of the JPEG2000. Compared with numerically lossless compression of JPEG2000, the proposed method achieves a 60% reduction in bitrate without visual quality degradation. Also, the proposed method yields superior image quality at equivalent bitrates, compared with conventional JPEG2000 encoders.