2
$\begingroup$

I have images from the internet and the corresponding URLs. I want to combine the image and the URL into one image. I don't want the URL to be placed over part of the image, but want the URL under the image. I tried GraphicsColumn and it worked, but makes the URL and the image the same size. In the code below, the 1273 is the width obtained via ImageDimensions. I tried changing the height also, but then the URL is not shown fully.

See this

The image of the triangle is at https://www.pinterest.com/pin/310115124325383020/ I want the URL to have the same width but a smaller height. Suggestions?

Mark

$\endgroup$
3
$\begingroup$
img = RandomImage[1, {350, 150}, ColorSpace -> "RGB"];

Labeled[img, {"https://www.pinterest.com/pin/310115124325383020/"}, {Bottom}]

enter image description here

| improve this answer | |
$\endgroup$
1
$\begingroup$

I would suggest drawing the text directly onto the image using ImageCompose or HighlightImage. Example:

img = ExampleData[{"TestImage", "Mandrill"}];
{w, h} = ImageDimensions[img];

text = Text[Style["Mandrill", 20, Bold, TextAlignment -> Center]];
textImg = Rasterize@Graphics[{text}, ImageSize -> {w, 25}];

ImageCompose[
 ImagePad[img, {{0, 0}, {25, 0}}, White],
 textImg,
 {Center, Bottom},
 {Center, Bottom}
 ]

Output

With HighlightImage:

HighlightImage[
 ImagePad[img, {{0, 0}, {25, 0}}, White], {
  Black,
  Text[
   Style["Mandrill", 20, Bold, TextAlignment -> Center],
   {w/2, 0},
   {0, -1}
   ]
  }]

Same output as above.

| improve this answer | |
$\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.