X-rays are capable of penetrating some thickness of matter. Medical X-rays are produced by letting a stream of fast electrons come to a sudden stop at a metal plate; it is believed that X-rays emitted by the Sun or stars also come from fast electrons.
The images produced by X-rays are due to the different absorption rates of different tissues. Calcium in bones absorbs X-rays the most, so bones look white on a film recording of the X-ray image , called a radiograph. Fat and other soft tissues absorb less, and look gray. Air absorbs the least, so lungs look black on a radiograph.