This paper proposes an improved least significant bit (LSB) method for steganography to enhance the quality and security of stego images by minimizing changes to LSB, thereby increasing peak signal-to-noise ratio (PSNR) and signal-to-noise ratio (SNR). The proposed method shows better performance compared to traditional LSB methods by reducing vulnerabilities and improving resistance to image compression attacks. Experimental results demonstrate the effects of segment length on LSB changes, SNR, PSNR, and the time required for message hiding.