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?



2 Answers 2

img = RandomImage[1, {350, 150}, ColorSpace -> "RGB"];

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

enter image description here


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}];

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


With HighlightImage:

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

Same output as above.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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