franz wrote:Is it possible to shrink the Code and to do it without temporary files?
Yes it should be posible.
What I would do is read in the cover image as set
-set option:distort:viewport 500x550+0+0
then make a clone of the cover image and perspective distort directly to the desirded positions on the 'viewport' window. That is the exact coordinates that you want them to appear.
Repeat this for the lower image.
the top image can have a blue 'shadow' added around it.
while the bottom image can be made semi-transparent.
In this way you don't much around with offsets, resizing, flops, rotates, or any other modification you are currently performing. that is all these secondary 'distortions' can be done directly by the perspective distortion operation.
All that you need to do then is overlay the resulting two images together, and that can be done using -flatten onto your desired background color (black in your example)
As such everything can be done in a single command, with a lot fewer operations. However without a good full-size input and output example it is difficult to determine the coordinates to use.
WARNING: I leave for china Thursday week, so if you like me to help create this command I'll need the URL's of the full size example images. You can forum private mail them if you don't want them published.