add support for margin parameters in image module

Signed-off-by: Mattias Andrée <maandree@operamail.com>
format parameter support and automatisation

Signed-off-by: Mattias Andrée <maandree@operamail.com>