An apparatus for encoding an image, the apparatus comprising: an intra prediction unit configured to generate a prediction block corresponding to a current block according to an intra prediction mode selected out of a plurality of intra prediction modes; a transform unit configured to transform a residual block obtained by calculating a difference between an original block of the current block and the prediction block to generate a transform block; a quantization unit configured to quantize the transform block to generate a quantized transform block using a quantization step size; a scanning unit configured to scan quantized transform coefficients of the quantized transform block to generate one-dimensional quantized transform coefficients; and an entropy coding unit configured to entropy-code the 1D quantized transform coefficients, wherein, when a size of the transform block is larger than 4x4, the scanning unit divides the quantized transform coefficients into a plurality of sub-blocks and scans the plurality of sub-blocks and the quantized transform coefficients of each sub-block using a scan pattern determined according to the selected intra prediction mode, wherein, when the selected intra prediction mode is a horizontal mode, the scan pattern is a vertical scan, and wherein the intra prediction unit includes: a reference pixel generating unit configured to generate reference pixels using available reference pixels of the current block when unavailable reference pixels exist; a reference pixel filtering unit configured to adaptively filter reference pixels adjacent to the current block based on the selected intra prediction mode and a size of the current block; a prediction block generating unit configured to generate a prediction block of the current block according to the selected intra prediction mode; a prediction block filtering unit configured to adaptively filter some prediction pixels of the prediction block based on the selected intra prediction mode and the size of the current block; and a prediction mode coding unit configured to encode the selected intra prediction mode of the current block using an above intra prediction mode of an above block neighboring the current block and a left intra prediction mode of a left block neighboring the current block, wherein, when the above intra prediction mode or the left intra prediction mode is not available, the prediction mode coding unit set a DC mode as the above intra prediction mode or the left intra prediction mode. an intra prediction unit configured to generate a prediction block corresponding to a current block according to an intra prediction mode selected out of a plurality of intra prediction modes; a transform unit configured to transform a residual block obtained by calculating a difference between an original block of the current block and the prediction block to generate a transform block; a quantization unit configured to quantize the transform block to generate a quantized transform block using a quantization step size; a scanning unit configured to scan quantized transform coefficients of the quantized transform block to generate one-dimensional quantized transform coefficients; and an entropy coding unit configured to entropy-code the 1D quantized transform coefficients, a reference pixel generating unit configured to generate reference pixels using available reference pixels of the current block when unavailable reference pixels exist; a reference pixel filtering unit configured to adaptively filter reference pixels adjacent to the current block based on the selected intra prediction mode and a size of the current block; a prediction block generating unit configured to generate a prediction block of the current block according to the selected intra prediction mode; a prediction block filtering unit configured to adaptively filter some prediction pixels of the prediction block based on the selected intra prediction mode and the size of the current block; and a prediction mode coding unit configured to encode the selected intra prediction mode of the current block using an above intra prediction mode of an above block neighboring the current block and a left intra prediction mode of a left block neighboring the current block,