An X-ray is a quick, painless test that produces images of the structures inside your body, particularly your bones. Beams of X-rays are produced by a machine which passes through the body and depending upon the density of various body parts, they are absorbed. Bone, metal etc. which are dense are seen on X-rays. The air in the lungs and body appears black.