0
$\begingroup$

I created a code to make an image composition ...

back=Import["https://i.stack.imgur.com/ouBUD.png"];
img1=Import["https://i.stack.imgur.com/0o8UW.png"];
img2=Import["https://i.stack.imgur.com/uHQWP.png"];
Graphics[{Inset[back,{Center,Center}],Inset[img1,{Left,Bottom}],Inset[img2,{Right,Top}]}]

I tested the dimensions to confirm that this composition is possible:

ImageDimensions[back]
ImageDimensions[img1]
ImageDimensions[img2]

I'm trying to generate the image below:

Image

What is missing from the code so I can get what I want?

$\endgroup$

2 Answers 2

2
$\begingroup$

Need to specify positions for Inset in a specific way.

Graphics[{Inset[back, {Center, Center}, {Center, Center}, ImageDimensions[back]],
  Inset[img1, Scaled[{0, 0}]],
  Inset[img2, Scaled[{1, 1}]]}]

enter image description here

$\endgroup$
2
$\begingroup$

Perhaps ImageCompose?

Fold[ImageCompose[#, #2[[1]], #2[[2]], #2[[2]]] &, 
  back, {{img1, {Left, Bottom}}, {img2, {Right, Top}}}]

enter image description here

If you wish to have a Graphics object, just wrap with Show:

Show[%, ImageSize -> 600, Frame -> True, PlotRangePadding -> Scaled[.02]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.