TellWorldAI World Archive
Ask中文

Home›Practice›Practice

Practice

Batch AI illustration

Make a series of AI cover illustrations with one shared style, convert them to small WebP files, and check each one for stray text with Apple's Vision framework. Covers the prompt file, cwebp options and upload order.

Who this is for and what you will be able to do

This article is for people who need a set of illustrations that look like one series, and who want a repeatable path from a written prompt to a small web image. After reading it you should be able to keep a prompt file, convert images with sips and cwebp, write a small check for text in images with Apple's Vision framework, and know why the upload order matters.

What the pipeline is

Our route has five steps: a prompt file, a generated image, resizing and conversion to WebP, a check for text, and upload. The check is the unusual part. The prompts already forbid text, but a model can still put letters into an image. A small Swift program built on Apple's Vision framework checks every image, and images with text are redrawn.[1] Vision's text recognition request, VNRecognizeTextRequest, is documented as "An image-analysis request that finds and recognizes text in an image", and it is available on macOS 10.15 and later, as well as iOS 13.0.[2]

The WebP step follows from the size of the originals. On 13 November 2026, PNG files of about 1.8 MB were converted into WebP files of 36 to 49 KB.[1] WebP is a format for the web that provides lossless and lossy compression. Its documentation says that WebP lossless images are 26% smaller than PNGs, and that WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index.[14]

Preparation

You need the cwebp encoder. The libwebp package includes the library and the command line tools cwebp and dwebp. A precompiled cwebp for Linux, Windows or macOS can be downloaded.[18][14] The pipeline also uses sips to resize.

Vision is an Apple framework. The request you will use, VNRecognizeTextRequest, is run through a VNImageRequestHandler, which processes one or more requests for a single image.[11]

Step by step

  1. Write the picture descriptions into content/media/prompts.json, one object per event with the fields subject, alt_en, alt_zh and source.[1]
  1. Attach the same style string to every prompt. It is the reason the covers look like one series. The string is "conceptual 3D render, soft studio lighting, matte materials, dark navy background with cool cyan rim light, minimal composition, shallow depth of field".[1]
  1. Add the prohibitions. Prompts forbid text, letters, numbers, logos, human faces and flags.[1]
  1. Generate the image from the prompt, then resize it to 720 by 1280 with sips -z 720 1280 and convert it with cwebp -quiet -q 80.[1] The cwebp manual gives these example invocations, which show how the options are written:[13]
cwebp -q 50 -lossless picture.png -o picture_lossless.webp
cwebp -q 70 picture_with_alpha.png -o picture_with_alpha.webp
cwebp -sns 70 -f 50 -size 60000 picture.png -o picture.webp
cwebp -o picture.webp -- ---picture.png
  1. Check the image for text. Write a small Swift program that runs VNRecognizeTextRequest on each image. Several properties control the check. recognitionLevel set to VNRequestTextRecognitionLevel.fast favors speed over accuracy, and VNRequestTextRecognitionLevel.accurate is for longer and more demanding recognition.[3] usesLanguageCorrection applies language correction when it is true; setting it to false returns raw results, which is faster but less accurate.[4] minimumTextHeight is relative to the image height, and its default is 0.03125, or 1/32.[5]
  1. Upload the image to object storage before you register it in the production database.[1]
  1. Pick the images to illustrate. Only news events with importance 4 or higher that have no cover yet are illustrated. A database query finds them after each import.[1]

Our practice

We illustrate only the events that need a cover. The query runs after every import, so the list is up to date each time.[1] The same style string across every prompt is what makes the covers read as one series.[1] By 13 November 2026, the media library held 642 AI-generated images and 25 photos.[1]

We upload before we register. On 8 November 2026 the order was the other way round, and for a short time the live site showed broken images. Since then the image goes to object storage first and the database row comes second.[1]

The size we chose is 720 by 1280, and the output is WebP at quality 80, which is what the commands above produce.[1] These are our choices for our site. They are not a general standard for every illustration set.

Limits and common problems

  • customWords is ignored when usesLanguageCorrection is false. When language correction is on, customWords takes precedence over the standard lexicon.[8]
  • automaticallyDetectsLanguage is available on iOS 16.0, iPadOS 16.0, macOS 13.0, tvOS 16.0 and visionOS 1.0. It decides whether the language should be detected to use the right model.[7]
  • recognitionLanguages takes ISO language codes in priority order, and the order determines which languages are used first.[6] supportedRecognitionLanguages() returns the languages a request supports.[9]
  • Text smaller than minimumTextHeight is ignored. Raising the value reduces memory use and speeds recognition, at the cost of missing small text.[5]
  • perform(_:) returns after all requests have completed or failed, so check each request's success or failure individually.[12]
  • WebP's maximum dimensions are 16383 x 16383 pixels.[15] Lossy WebP works with 8-bit Y'CbCr 4:2:0 images, and lossless WebP works with RGBA.[15]
  • If the file size is consistently larger than you want when converting a lossy source, lower the quality. The FAQ also suggests targeting a file size with -size instead of a quality setting, and notes that "targeting 80% of the original file size might prove more robust".[15]
  • cwebp does not support animated PNG or WebP input.[13]
  • The -preset option should come first among the arguments, because it overwrites the values of the other parameters except -q.[13]
  • Vision reads text. It cannot tell you whether a picture is a good illustration. That judgment is still a human one.

Next steps

Read the Vision documentation for VNRecognizeTextRequest[2] and the cwebp manual.[13] For the format itself, read the WebP FAQ.[15] Start with one image, check it by eye, then run the whole series through the same script.

Sources

  1. 1
  2. 2
    VNRecognizeTextRequestApple Developer Documentation
  3. 3
    recognitionLevelApple Developer Documentation
  4. 4
    usesLanguageCorrectionApple Developer Documentation
  5. 5
    minimumTextHeightApple Developer Documentation
  6. 6
    recognitionLanguagesApple Developer Documentation
  7. 7
    automaticallyDetectsLanguageApple Developer Documentation
  8. 8
    customWordsApple Developer Documentation
  9. 9
    supportedRecognitionLanguages()Apple Developer Documentation
  10. 10
    VNRecognizedTextObservationApple Developer Documentation
  11. 11
    VNImageRequestHandlerApple Developer Documentation
  12. 12
    perform(_:)Apple Developer Documentation
  13. 13
    cwebpGoogle for Developers
  14. 14
    An image format for the WebGoogle for Developers
  15. 15
    WebP FAQGoogle for Developers
  16. 16
  17. 17
    WebP API DocumentationGoogle for Developers
  18. 18
    libwebp READMEwebmproject/libwebp

Cite this page: Batch AI illustration. TellWorld, https://www.tellworld.net/practice/practice-ai-image-batch. Updated 2026-11-14

Related news

View all