Reversible data hiding within encrypted images reversible data hiding in encrypted images (RDH-EI) is a highly effective technique for image processing in the field of encryption. This paper, propose a RDH-EI technique, which utilizes bit-plane compression and various image scanning directions to generate vacant space for data embedding, referred to as vacating room. Initially, the prediction error of the pre-processed image is computed. Subsequently, each bit-plane image is converted into a bit-stream by following the pixel scan order employed before compression. The compressed image is then encrypted employing a stream cipher. Through the process of substitution, the secret data and additional information are incorporated into the acquired image without any knowledge of the original content or the encrypted key. Finally, the generated image is transmitted or archived. The experiments provide evidence that the proposed method surpasses the most advanced methods currently available.