Digital image capturing technologies and the Internet are widely used today. These technologies make it very easy and fast to capture and share personal images in daily life. This causes difficulties in ensuring the confidentiality of private data and risks such as third persons getting hold of these data. The main goal of this study is to develop a user-friendly, powerful and effective method to encrypt digital images. For this aim, we propose a new block encryption method based on the Profile Hidden Markov Model. The method we propose consists of three main components. These are probability vector (PV), initialization vector (IV) and substitution-box (8box). Encryption is in 24-bit blocks for color images and 8-bit blocks for grayscale images. The encryption rate in the proposed block encryption method is 0.7747 Mbit/s for color images and 1.0535 Mbit/s for the grayscale images. Theoretical analysis and experimental results confirm that the proposed encryption algorithm can provide high security both for color and grayscale images.