What version of Imagemagick are you using?Ok, is there a way to automatically detect the size of the picture and resize to A4 ?
You might be better off writing a script to get and calculate the dimensions and passing the dimensions as variables into the Imagemagick command.