The X-ray devices in luggage scanners are a bit more complicated than the X-ray medical imaging devices. In particular, they’re set up to identify and distinguish between different kinds of objects, whereas medical X-rays are pretty much only interested in one: bones.
The trick is that not all X-rays are created equal. The X-ray source will send out X-rays in a range of energy levels. Organic objects block some low-energy X-rays, but not higher-energy ones. Plastics block low-energy X-rays better than organic objects, but not as effectively as metal objects, which pretty much block everything.
The device is set up so that the X-rays pass through your luggage and then hit the first detector, which sends an image to the computer. But the X-rays then pass through a filter that blocks out all low-energy X-rays before hitting a second detector. That sends another image to the computer, this time only showing those objects that block high-energy X-rays. By combining these two images, the software can distinguish between organics, inorganics (e.g., plastics), and metals. It then assigns different colors to each.
Most manufacturers use black for metal and orange for organics, but it could vary from machine to machine. The general rule followed here is simple; the denser the material, the darker the color appears.
In all X-ray machines, for the scrutiny of luggage, two X-ray sources are used. One is fixed at the top and the other one at the side, to provide two views of the same package so that nothing is missed from any direction. When an illegal item is detected, the material is identified by studying it in both views and outlining it. The Z effective number is then used to determine the material the object is made of. This reduces false alarms.
So, in all fancy malls and restaurants and at airports, when you put your bag behind the lead-lined curtains, your bags and luggage areX-rayed. The curtains are lead-lined for a reason. As said before, only very high energy X-rays can pass through metal, and lead being the heaviest of metals, does not allow even the strongest of X-rays to penetrate. This protects the security personnel and the people standing nearby as X-rays are hazardous for the human body. All the items are scanned, and if anything fishy is found, the alarm beeps, and they know what the item of concern is and whose bag it is.
Different from medical X-ray scanners, the main technique is the one described above. The scanners use X-rays of two different intensities. Therefore, they can easily distinguish between different objects; the lighter ones being plastics and the like, and the heavier items are metals. These X-rays can detect items hidden underneath clothing, so no one has a chance to hide and transport any banned items. Banned food items can also not pass through these sensitive X-ray scanners at the airport.