How to open or convert .xwd image dump?
Alternatively use ImageMagick which support jpeg, png and other popular formats, example usage:

import -window root screen.jpeg


Install by brew install imagemagick --with-x11