The objective of the study was to evaluate whether magnetic resonance imaging (MRI) offers the opportunity to reliably analyze body composition of pigs in vivo. Therefore, the relation between areas of loin eye muscle and its back fat based on MRI images were used to predict body composition values measured by dual energy X-ray absorptiometry (DXA). During the study, a total of 77 pigs were studied by MRI and DXA, with a BW ranging between 42 and 102 kg. The pigs originated from different extensive or conventional breeds or crossbreds such as Cerdo Iberico, Duroc, German Landrace, German Large White, Hampshire and Pietrain. A Siemens Magnetom Open was used for MRI in the thorax region between 13th and 14th vertebrae in order to measure the loin eye area (MRI-LA) and the above back fat area (MRI-FA) of both body sides, whereas a whole body scan was performed by DXA with a GE Lunar DPX-IQ in order to measure the amount and percentage of fat tissue (DXA-FM; DXA-%FM) and lean tissue mass (DXA-LM; DXA-%LM). A linear single regression analysis was performed to quantify the linear relationships between MRI- and DXA-derived traits. In addition, a stepwise regression procedure was carried out to calculate (multiple) regression equations between MRI and DXA variables (including BW). Single regression analyses showed high relationships between DXA-%FM and MRI-FA (R2 = 0.89, √MSE = 2.39%), DXA-FM and MRI-FA (R2 = 0.82, √MSE = 2757 g) and DXA-LM and MRI-LA (R2 = 0.82, √MSE = 4018 g). Only DXA-%LM and MRI-LA did not show any relationship (R2 = 0). As a result of the multiple regression analysis, DXA-LM and DXA-FM were both highly related to MRI-LA, MRI-FA and BW (R2 = 0.96; √MSE = 1784 g, and R2 = 0.95, √MSE = 1496 g). Therefore, it can be concluded that the use of MRI-derived images provides exact information about important ‘carcass-traits’ in pigs and may be used to reliably predict the body composition in vivo.