My Panasonic/Lumix DMC-GX80 contains a build-in function “Post-Focus”, where the camera takes several pictures with varying focus (Example image). Lately I was a bit disappointed by the results and I looked up the internet for alternatives. On Focus Stacking Macro Photos by Pat David I found a pretty easy and description. You need your pictures with varying focus (here shown 3 out of 30 I took). Ideally take them with a tripod and remote control.
You need two commands, one to align the images (this was still neccessary, although I used a tripod and remote control) and one to combine them. For Debian the required packages are hugin-tools and enfuse
align_image_stack -m -a aligned_ P1040*
enfuse --exposure-weight=0 \
--saturation-weight=0 \
--contrast-weight=1 \
--hard-mask \
--output=stacked.tif aligned_*.tif
I was pretty impressed by the result: