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
- Write the picture descriptions into
content/media/prompts.json, one object per event with the fieldssubject,alt_en,alt_zhandsource.[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]
- Add the prohibitions. Prompts forbid text, letters, numbers, logos, human faces and flags.[1]
- Generate the image from the prompt, then resize it to 720 by 1280 with
sips -z 720 1280and convert it withcwebp -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- Check the image for text. Write a small Swift program that runs
VNRecognizeTextRequeston each image. Several properties control the check.recognitionLevelset toVNRequestTextRecognitionLevel.fastfavors speed over accuracy, andVNRequestTextRecognitionLevel.accurateis for longer and more demanding recognition.[3]usesLanguageCorrectionapplies language correction when it istrue; setting it tofalsereturns raw results, which is faster but less accurate.[4]minimumTextHeightis relative to the image height, and its default is0.03125, or 1/32.[5]
- Upload the image to object storage before you register it in the production database.[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
customWordsis ignored whenusesLanguageCorrectionisfalse. When language correction is on,customWordstakes precedence over the standard lexicon.[8]automaticallyDetectsLanguageis 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]recognitionLanguagestakes 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
minimumTextHeightis 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
-sizeinstead 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
-presetoption 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
- 2VNRecognizeTextRequestApple Developer Documentation
- 3recognitionLevelApple Developer Documentation
- 4usesLanguageCorrectionApple Developer Documentation
- 5minimumTextHeightApple Developer Documentation
- 6recognitionLanguagesApple Developer Documentation
- 7automaticallyDetectsLanguageApple Developer Documentation
- 8customWordsApple Developer Documentation
- 9supportedRecognitionLanguages()Apple Developer Documentation
- 10VNRecognizedTextObservationApple Developer Documentation
- 11VNImageRequestHandlerApple Developer Documentation
- 12perform(_:)Apple Developer Documentation
- 13cwebpGoogle for Developers
- 14An image format for the WebGoogle for Developers
- 15WebP FAQGoogle for Developers
- 16WebP RIFF Container SpecificationGoogle for Developers
- 17WebP API DocumentationGoogle for Developers
- 18libwebp READMEwebmproject/libwebp
Cite this page: Batch AI illustration. TellWorld, https://www.tellworld.net/practice/practice-ai-image-batch. Updated 2026-11-14