We compared the detection characteristics of a pixel area X-ray detector, Medipix-2, with those of a CCD-based X-ray detector. The goal was to challenge the overall imaging performance of the emerging pixel area detection technique against that of a well-known detection device, in view of applications on synchrotron beamlines. A CCD-based detector was chosen as the reference because of the intensive and widespread use of CCD systems on beamlines. In order to establish the comparison on an absolute side-by-side basis we built an optimized CCD-based system with the same input pixel size as Medipix-2 and we characterized both systems in identical conditions. We present the results obtained, in particular the frequency-dependent noise, spatial response and DQE. We also report on various test experiments with Medipix-2 in X-ray scattering and X-ray imaging using a synchrotron source.