graphics/ImageMagick or its newer version, or its fork graphics/GraphicsMagick. They may work slightly differently but the general idea is the same.For example, I press Ctrl+Print Scrn and the snapshot of my screen is taken. Or, I drag a rectangle to take a snapshot of my screen.
import /tmp/snap.pngand drag the rectangle. And for a screenshot of the entire screen use
import -window root /tmp/snap.png.