> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Create images from text


You can use Cloudinary to dynamically generate an image from a given textual string using the [`text`](image_upload_api_reference#text_optional_parameters) method of the Upload API. For example, to create an image from the text string "Hello World":

```multi
|ruby
Cloudinary::Uploader.text('Hello World')

|php_2
$cloudinary->uploadApi()->text('Hello World');

|python
cloudinary.uploader.text("Hello World")

|nodejs
cloudinary.v2.uploader
.text('Hello World')
.then(result=>console.log(result)); 

|java
cloudinary.uploader().text("Hello World",
  ObjectUtils.emptyMap());

|csharp
var textParams = new TextParams("Hello World");
var textResult = cloudinary.Text(textParams); 

|go
resp, err := cld.Upload.Text(ctx, uploader.TextParams{
    Text: "Hello World"})

|cli
cld uploader text "Hello World"
```

> **NOTE**: Cloudinary supports dynamic text overlays without predefining text images. See the documentation on [Adding text captions](layers#text_overlays) and the blog post on [How to overlay text on image easily, pixel perfect and with no CSS/HTML](/blog/how_to_overlay_text_on_image_easily_pixel_perfect_and_with_no_css_html) for more details.

## Optional parameters

You can also optionally include various font, color and style parameters that can be specified to customize the look & feel of the text based image. For a full listing of the possible optional parameters available for the `text` method, see the [Upload API reference](image_upload_api_reference#text_optional_parameters).

For example, to create an image of the text string "Sample Name" in 12 point, black, Arial font with 90% opacity, and the public ID of "dark_name":

```multi
|ruby
Cloudinary::Uploader.text("Sample Name",
  public_id: "dark_name",
  font_family: "Arial", 
  font_size: 12,
  font_color: "black",
  opacity: 90)

|php_2
$cloudinary->uploadApi()->text("Sample Name", [
    "public_id" => "dark_name",
    "font_family" => "Arial", 
    "font_size" => 12,
    "font_color" => "black", 
    "opacity" => 90]);

|python
cloudinary.uploader.text("Sample Name",
  public_id = "dark_name",
  font_family = "Arial", 
  font_size = 12,
  font_color = "black",
  opacity = 90)

|nodejs
cloudinary.v2.uploader
.text("Sample Name",
  { public_id: "dark_name",
    font_family: "Arial", 
    font_size: 12,
    font_color: "black", 
    opacity: 90 })
.then(result=>console.log(result)); 
         
|java
cloudinary.uploader.text("Sample Name",
  ObjectUtils.asMap(
    "public_id", "dark_name",
    "font_family", "Arial",
    "font_size", 12,
    "font_color", "black",
    "opacity", "90"));

|csharp
var textParams = new TextParams("Sample Name"){
  PublicId = "dark_name",
  FontFamily = "Arial",
  FontSize = 12,
  FontColor = "black",
  Opacity = 90};
var textResult = cloudinary.Text(textParams); 

|go
resp, err := cld.Upload.Text(ctx, uploader.TextParams{
		Text:       "Sample Name",
		PublicID:   "dark_name",
		FontFamily: "Ariel",
		FontSize:   12,
		FontColor:  "black",
		Opacity:    "90"})

|cli
cld uploader text "Sample Name" public_id="dark_name" font_family="Arial" font_size=12 font_color="black" opacity=90
```

The resulting image will also include all the styling information stored as metadata, which means the resulting image can be referred to as a "text style" base for creating text overlays on the fly. See the documentation on [Text style images](layers#predefined_text_templates) for more information.

## Response

The API call returns a JSON response including the URLs for accessing the generated image through a CDN, the assigned public ID and the current version of the resource.

For example:

```json
{
  "asset_id": "5f3a66a07429c5e36e8fb73bee30e860",
  "public_id": "0cf83f1fab2760f36dcab598030f56ab",
  "version": 1719311171,
  "version_id": "4ecaa07afe4ea835874bf1e2268a9a05",
  "signature": "e7ba4bcb56bdc6083eadeed2bf5bfd004c670c83",
  "width": 73,
  "height": 10,
  "format": "png",
  "resource_type": "image",
  "created_at": "2024-06-25T10:26:11Z",
  "tags": [],
  "bytes": 746,
  "type": "text",
  "etag": "563af6387b3dd4c425e5dd38d0a8fe25",
  "placeholder": false,
  "url": "http://res.cloudinary.com/cld-docs/image/text/v1719311171/0cf83f1fab2760f36dcab598030f56ab.png",
  "secure_url": "https://res.cloudinary.com/cld-docs/image/text/v1719311171/0cf83f1fab2760f36dcab598030f56ab.png",
  "asset_folder": "",
  "display_name": "0cf83f1fab2760f36dcab598030f56ab"
}
```
