The present invention relates to a method for obtaining information from a medication package (103). In the method, an image of the medication package (103) is provided, the image is analysed to determine positions and formats of patterns (304, 305, 306) in the image, a layout, which has similar pattern formats in the same positions as the image, is selected from a set of layouts stored in the medication dispenser (100), the selected layout defining the type of information for each pattern (304, 305, 306) in the image, and the information contained in at least one of the patterns (304, 305, 306) of the image is interpreted by linking the content of the pattern (304, 305, 306) to the type of information defined in the selected layout. The invention also relates to a medication dispenser (100).