A method of encoding an image, the method comprising: dividing an image into a plurality of maximum coding units having a predetermined maximum size of a coding unit; determining whether a first coding unit (1020, 1040) includes a region that extends over a boundary (1010, 1030) of the image by comparing a lower boundary of the first coding unit to a lower boundary of the image, wherein the first coding unit (1020, 1040) is one of the plurality of maximum coding units; when the first coding unit includes the region that extends over the boundary (1010, 1030) of the image, dividing the first coding unit into second coding units (1150, 1160, 1170, 1180) and encoding only second coding units (1150, 1160) that are in an internal region of the image, from among the second coding units (1150, 1160, 1170, 1180) generated by dividing the first coding unit; and when the first coding unit does not include the region that extends over the boundary (1010, 1030) of the image, encoding the first coding unit by performing prediction and transformation without dividing the first coding unit, characterized in that: dividing the first coding unit into the second coding units (1150, 1160, 1170, 1180) comprises dividing a height and a width of the first coding unit (1020, 1040) by two; and when a Y-coordinate of the lower boundary of the first coding unit is larger than the height of the image, the first coding unit is determined to include the region that extends over the lower boundary of the image, the first coding unit is divided into the second coding units (1150, 1160, 1170, 1180), and flag information about division of the first coding unit into the second coding units (1150, 1160, 1170, 1180) is not encoded. dividing an image into a plurality of maximum coding units having a predetermined maximum size of a coding unit; determining whether a first coding unit (1020, 1040) includes a region that extends over a boundary (1010, 1030) of the image by comparing a lower boundary of the first coding unit to a lower boundary of the image, wherein the first coding unit (1020, 1040) is one of the plurality of maximum coding units; when the first coding unit includes the region that extends over the boundary (1010, 1030) of the image, dividing the first coding unit into second coding units (1150, 1160, 1170, 1180) and encoding only second coding units (1150, 1160) that are in an internal region of the image, from among the second coding units (1150, 1160, 1170, 1180) generated by dividing the first coding unit; and when the first coding unit does not include the region that extends over the boundary (1010, 1030) of the image, encoding the first coding unit by performing prediction and transformation without dividing the first coding unit, characterized in that: dividing the first coding unit into the second coding units (1150, 1160, 1170, 1180) comprises dividing a height and a width of the first coding unit (1020, 1040) by two; and when a Y-coordinate of the lower boundary of the first coding unit is larger than the height of the image, the first coding unit is determined to include the region that extends over the lower boundary of the image, the first coding unit is divided into the second coding units (1150, 1160, 1170, 1180), and flag information about division of the first coding unit into the second coding units (1150, 1160, 1170, 1180) is not encoded. dividing the first coding unit into the second coding units (1150, 1160, 1170, 1180) comprises dividing a height and a width of the first coding unit (1020, 1040) by two; and when a Y-coordinate of the lower boundary of the first coding unit is larger than the height of the image, the first coding unit is determined to include the region that extends over the lower boundary of the image, the first coding unit is divided into the second coding units (1150, 1160, 1170, 1180), and flag information about division of the first coding unit into the second coding units (1150, 1160, 1170, 1180) is not encoded.