Eldo asks: How can we reproduce Charles Demuth’s “Figure 5 in Gold”? Some fiddling with Dall-E-3/GPT-4/(V)…

Things you cannot do

You might be wondering why not just ask directly, and the answer is that direct references to artists from the last 100 years are prohibited:

ServiceExecute["OpenAI", "ImageCreate", 
  {"Prompt" -> "Generate an abstract American Precisionist painting in the style of Charles Demuth's \"I Saw the Figure 5 in Gold\"", 
   "Model" -> "dall-e-3"}]

0n30vkjwoefmp

1xzv44rt021gw

Dall-E-3: Using the same poem as inspiration prompt

The painting was inspired by a William Carlos William’s poem…so maybe we use that as a prompt muse:

poem =  "Among the rainand lights I saw the figure 5 in goldon a red fire truck moving tense unheeded to gong clangs siren howls and wheels rumbling through the dark city"; 
 
ServiceExecute["OpenAI", "ImageCreate", {"Prompt" -> "Create an illustration of the following poem in the style of an American Precisionism painting. Precisionist artists reduced subjects to their essential geometric shapes and were fascinated by the sleekness and sheen of machine forms:\n" <> poem, 
   "Model" -> "dall-e-3"}]

196yk97osts9w

Perhaps a bit too literal. Let’s enforce the idea that this is an abstract painting rather than an illustration:

ServiceExecute["OpenAI", "ImageCreate", 
   {"Prompt" -> "Create an abstract painting about this poem in the style of an American Precisionism painting. Precisionist artists reduced subjects to their essential geometric shapes and were fascinated by the sleekness and sheen of machine forms.  Use bold geometrical forms.  The number 5 should appear in different shades of yellow.  There should be red and black geometrical shapes and white disks. The text is:\n" <> poem, 
   "Model" -> "dall-e-3"}]

1m6a957577ckc

Let’s also try to force it to not be so literal about the fire engine:

ServiceExecute["OpenAI", "ImageCreate", 
   {"Prompt" -> "Create an abstract painting about this poem in the style of an American Precisionism painting. Precisionist artists reduced subjects to their essential geometric shapes and were fascinated by the sleekness and sheen of machine forms.  Use bold geometrical forms.  The number 5 should appear in different shades of yellow.  There should be red and black geometrical shapes and white disks. Do not actually depict a literal fire truck, but instead include abstract red blocks. The text is:\n" <> poem, 
   "Model" -> "dall-e-3"}]

0actxdsx5rl9x

Use GPT-4-Vision descriptions

Although we cannot name the painting directly, we can try to have GPT-4-V read it and generate a description and use the resulting description to generate new images. Let’s see if we can do it in code…

Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/Misc/LLMVision.m"];

1entjv85n1o4o

(*"The painting depicted in the image is a complex composition that combines geometric shapes and textual elements in an abstract manner. It is characterized by:- A dominant central motif of a large circle intersected by the number \"5\", which is prominent in the foreground.- The palette includes shades of red, yellow, black, and white with varying gradients to create a sense of depth and dimensionality.- Angular geometric shapes, including rectangles, triangles, and other polygonal forms, form a background that is reminiscent of Cubist influences. These shapes create a sense of fragmentation and dynamism.- Additional textual elements are visible, for example, \"No. 5\" is written again in the lower part of the circle, and there are fragments of other words and letters, such as \"DILL\" and \"CARLIC,\" appearing in the rest of the composition. The text is stylized and integrated into the geometric design.- The use of shading and perspective suggests a three-dimensional space, and the layering of shapes and colors contributes to a complex, multi-planar effect.- The lighting in the composition appears to be strategically placed to highlight certain elements and enhance the three-dimensionality of the shapes.Creating a similar image using Wolfram Language would be quite involved and require advanced programming techniques to replicate the geometric complexity and color gradients. For a simple approximation that captures geometric and stylistic elements, consider the following code snippet that would generate an abstract composition with a large central number and geometric shapes:```wolframGraphics[{ {Red, Disk[{0, 0}, 1]},{Yellow, Rotate[Text[Style[\"5\", FontSize -> 72, Bold, Italic, FontColor -> White]], Pi/4, {0, 0}]},{Black, Rectangle[{-1.5, -1}, {-0.5, 1}]},{Black, Rectangle[{0.5, -1}, {1.5, 1}]},{White, Polygon[{ {-0.5, 0.5}, {0.5, 0.5}, {0, 1}}]},{Black, Polygon[{ {-0.5, -0.5}, {0.5, -0.5}, {0, -1}}]}},PlotRange -> { {-2, 2}, {-2, 2}},Background -> Gray]```Note that the above code is a very simplified interpretation and would not replicate the intricate details, text elements, or the exact style of the original painting. It would require much more sophisticated programming to approach a closer resemblance, including creating custom shapes, applying gradients, and integrating textual elements properly."*)

How does the program look?

Graphics[
  {
    {Red, Disk[{0, 0}, 1]}, 
    {Yellow, Rotate[Text[Style["5", FontSize -> 72, Bold, Italic, FontColor -> White]], Pi/4, {0, 0}]}, 
    {Black, Rectangle[{-1.5, -1}, {-0.5, 1}]}, 
    {Black, Rectangle[{0.5, -1}, {1.5, 1}]}, 
    {White, Polygon[{ {-0.5, 0.5}, {0.5, 0.5}, {0, 1}}]}, 
    {Black, Polygon[{ {-0.5, -0.5}, {0.5, -0.5}, {0, -1}}]} 
   }, 
  PlotRange -> { {-2, 2}, {-2, 2}}, 
  Background -> Gray 
 ]

0vlds6i1bea5g

Description plus Dall-E-3

Let’s use the text description from above as input to Dall-E-3 (we could do this more programmatically, but I didn’t want to make another API request, so I just copy-pasted from above):

With[
  {description = "The painting depicted in the image is a complex composition that combines geometric shapes and textual elements in an abstract manner. It is characterized by:\\n\\n- A dominant central motif of a large circle intersected by the number \"5\", which is prominent in the foreground.\\n- The palette includes shades of red, yellow, black, and white with varying gradients to create a sense of depth and dimensionality.\\n- Angular geometric shapes, including rectangles, triangles, and other polygonal forms, form a background that is reminiscent of Cubist influences. These shapes create a sense of fragmentation and dynamism.\\n- Additional textual elements are visible, for example, \"No. 5\" is written again in the lower part of the circle, and there are fragments of other words and letters, such as \"DILL\" and \"CARLIC,\" appearing in the rest of the composition. The text is stylized and integrated into the geometric design.\\n- The use of shading and perspective suggests a three-dimensional space, and the layering of shapes and colors contributes to a complex, multi-planar effect.\\n- The lighting in the composition appears to be strategically placed to highlight certain elements and enhance the three-dimensionality of the shapes.", 
   prompt = "Precisionist artists reduced subjects to their essential geometric shapes and were fascinated by the sleeknes and sheen of machine forms. Create an illustration in the style of an American Precisionism painting based on the following description:\n" 
  }, 
  ServiceExecute["OpenAI", "ImageCreate", 
   {"Prompt" -> prompt <> description, 
    "Model" -> "dall-e-3"}]]

08w1lwyti8rni

Definitely charming, not at all like the original painting, but has some stylistic resonance

ToJekyll["Computational Painting: After Charles Demuth", "llm ai art"]