use the libxml2 pretty-printer
cache the image before write for fits

write must be strictly top-to-bottom for :seq to work