This code produces two identical images, despite the difference in the rectangles:
r1 = Rectangle[{-1, -1}, {1, 1}];
r2 = Rectangle[{-1, -1}, {0, 1}];
f[img_] :=
Show[ParametricPlot3D[{{t, 0, 0}, {0, t, 0}, {0, 0, t}}, {t, -1, 1}],
Graphics3D[{Inset[
Show[Graphics[img], ImageSize -> Large], {0.25, 0, 0}, Automatic,
ImageScaled[0.25]]}]]
f[r1]
f[r2]
If I do {Automatic,ImageScaled[0.25]}
, I am told that it should be a pair of numbers, or a scaled or offset form.
I want the height of the inset to be 25% of the overall graphic, and the width to be scaled accordingly. I want it to work for any img
, not just the two rectangles I gave; my actual use case involves .gif files. How do I make it so that f[r1]
and f[r2]
show different insets, i.e., inset the rectangles shown by Show[r1]
and Show[r2]
, with the height scaled to 25% of the total height of the image?