1. A method of decoding an image, the method comprising: obtaining information that indicates an intra prediction mode of a current block to be decoded, from a bitstream, the intra prediction mode indicating a particular direction among a plurality of directions, the particular direction being indicated by one of dx number of pixels in a horizontal direction and a fixed number of pixels in a vertical direction, and dy number of pixels in the vertical direction and a fixed number of pixels in the horizontal direction; and obtaining a number of neighboring pixels located on one side among a left side of the current block and an upper side of the current block according to a position of a current pixel (j,i) and the particular direction (dx or dy) indicated by the intra prediction mode, when the number of the neighboring pixels is 1, obtaining a prediction value of the current pixel based on the neighboring pixel; and when the number of the neighboring pixels is 2, obtaining the prediction value of the current pixel based on a weighted average of the neighboring pixels, wherein the image is split into a plurality of maximum coding units according to the extracted information about the maximum size of the coding unit, the maximum coding unit is hierarchically split into one or more coding units of depths including at least one of a current depth and a lower depth according to the split information, when the split information indicates a split for the current depth, the coding unit of a current depth is split into four coding units of a lower depth, independently from neighboring coding units, and when the split information indicates a non-split for the current depth, one or more prediction units are obtained from the coding unit of the current depth.