#!/bin/sh wl-paste -t image > /tmp/convert-paste-png.data #convert /tmp/convert-paste-png.data -format png "$1" case "$(file --dereference --brief --mime-type -- "/tmp/convert-paste-png.data")" in image/jpg|image/jpeg) convert /tmp/convert-paste-png.data -format png "$1" ;; image/png) wl-paste -t image/png > "$1" ;; esac