In this paper, after reviewing the main points of image encryption and threshold function, we introduce the methods of chaotic image encryption based on pseudorandom bit padding that the bits be generated by the novel generalized threshold function (segmentation and self-similarity) methods. These methods decrease periodic effect of the ergodic dynamical systems in randomness of the chaotic image encryption. The essential idea of this paper is that given threshold functions of the ergodic dynamical systems. To evaluate the security of the cipher image of this scheme, the key space analysis, the correlation of two adjacent pixels and differential attack were performed. This scheme tries to improve the problem of failure of encryption such as small key space and level of security.