What is the best solution to insert text at defined poition into image?
I saw this question/answer but it does not help me for my examples below.
I tried the following and find some strange behaviour:
image = Image[Array[0 &, {200, 400}]];
Example 1:
text = "This is a very long text";
textImage =
textImage = Rasterize[Style[text, FontFamily -> "Calibri", 30]];
composedImage = Show[image, textImage]
Example 2:
text = "This is a very long text This is a very long text This is a very long text This is a very long text";
textImage =
textImage = Rasterize[Style[text, FontFamily -> "Calibri", 30]];
composedImage = Show[image, textImage]
Here the text is cropped.
Example 3:
text = "This is a very long text This is a very long text This is a very long text This is a very long text This is a very long text";
textImage =
textImage = Rasterize[Style[text, FontFamily -> "Calibri", 30]];
composedImage = Show[image, textImage]
I don't understand why here the text is wrapped but not left aligned. It seems that when the text exceeds a certain length (probably depending on text size) this happens.
What would you propose to insert text into an Image?
LineIndent -> 0
inStyle
. Default value is1.
. $\endgroup$LineIndent -> 0
in example 3 I get 2 rows now left aligned and wrapped. How can I have a single line although it is too long and not everything seen? In general: I believe that my way how I insert text is not the correct one. There must be a more elegant solution, where I also can set the position. $\endgroup$LineBreakWithin -> False
inStyle
. $\endgroup$