Capabilities and Preparation
Use image-remove-text to intelligently recognize and remove text and text watermarks from images, repair the covered background, and improve the cleanliness and usability of the picture. When the material and text cleanup target are clear, execute directly; the server side completes recognition and processing.
Invoke the server-side processing capability through the parameters supported by the current CLI; for specific parameters, query help or contracts. Depends on meitu-kaipai-cli, verified target version 0.1.8, compatible with >=0.1.8 <0.2.0。
On first execution, readPlatform Access, parse the CLI entry point and check the version and tool image-remove-text --help. When JSON fields or media restrictions are unclear, query kaipai contracts for the current tool's entry according to the platform instructions; when encountering output parsing, server-side inquiries, or execution exceptions, readRunning and Recovery。
Collect Input
- Obtain one real image file or URL from the current request and attachments; do not ask repeatedly when the information is clear. When there are multiple candidates and the target is unclear, ask; do not automatically choose on the user's behalf; when the user has explicitly authorized processing them one by one, call separately and record the tasks.
- For local materials, use a real readable path; for remote materials, first followPlatform Accessto download the original resource, then upload it as a local file. When only a media ID is available, first query the Task or history of the session it belongs to in order to obtain the real URL, then download; if that fails, ask the user to download it themselves and provide the local original file.
- When continuing an existing task, add
-r '<session_id>'; for a new task, omit the session. Apply defaults, prepare login, and handle missing inputs according to the platform instructions; query the current help for optional parameters, and omit them when unspecified. - Keep the original source, real local path, and session as recovery inputs. After the user supplements with a downloaded file, continue with the original target; do not treat failed results as source material.
Upload and Submit
Using the parsed CLI entry point, pass the prepared local file as an independent parameter:
kaipai tool image-remove-text --image-file '<本地图片路径>'
After the CLI validates the file, obtain a proprietary CDN URL through the built-in Meitu upload pipeline, then submit the task and by default wait for this execution to finish. Do not first call create-room / add-media, and do not construct media placeholder text. Parameter files and independent prechecks are used only as needed; for secure parameter passing and cleanup rules, see the platform instructions.
Follow-up and Delivery
- Save the original input,
session_id / room_urland all real Task IDs; continuously read the stdout and stderr of the original command separately, and do not open another polling process at the same time. TASK_STATE_COMPLETEDand only deliver the processing result after obtaining a usable artifact URL for this execution. HTTP 200, end of stream, exit code 0, orend.reason=resultdo not individually prove completion, and an unknown task status cannot be regarded as success.- Use the host's available native preview/attachment or a complete clickable URL, preserve query parameters, and deliver all available Parts one by one; for partial success, deliver the successful parts first. When there is an actual
room_url, attach the Kaipai session entry; do not construct links from IDs. - When disconnected, timed out, or acceptance is unknown, first query the original session and task; do not automatically resubmit. Only initiate a new attempt after the failure cause has been fixed and the user has authorized a retry; if downloading the output artifact fails, only resume the download. For specific inquiry, recovery, and local save steps, see the running instructions.