In an industrial setting, it is common for PCB/component inspection to take images using a telecentric lens, to eliminate all perspective on any tall components around the sides (and also allow precision measurement using optical processing only). That, coupled with good lighting and sometimes polarization can result in pictures of components so perfect that they look like they were renderings.
I've been thinking about doing this with a telecentric lens but the one in have is like 5 inches so would need to stitch a bunch of images for a bigger board. And bigger lenses are big bucks.
The issue with this is you need flat PCBs due to the depth of field of a flatbed scanner. Even in that article they had to remove components from it. That's quite annoying since most of the boards I have have stacked USB connectors.
If you don't have a lightbox, a long exposure (15-30 seconds, might need a very small f-stop or ND filter) and waving an LED torch around the PCB is almost as good at removing all the shadows, but less consistent.
A bit more on the technic (and expensive) side, you can use a Tilt-Shift lens to change the focus plane and get striking results with PCBs or any other small items.
The ingenious trick at the end: using a lightbox, take two pictutee: one with cirre lighting, and another heavily underexposed. The latter shows everything black but the background, and serves as a perfect mask for the former for background removal.
It's sort of anti-HDR. The author automates processing using imagemagick.
So far has not been needed. With the lens I'm using and the amount of light I can stop it down to f/8 and not have issues with blurry parts. For the macro pictures of components I need to look into focus stacking if I want to have both the board and the chip number in focus but that's not a big priority for me.