This job starts from the product's real photo. Generating a product from words alone draws something that isn't the product. Cutting out the background and setting a colour behind it costs nothing. Generating a scene costs money (see the Stop in step 4).
Ask first
- Which product? By name. If it has several photos, which one.
- What should change? A plain background (which colour), a cut-out with no background, or a generated scene (describe the place, the light, the mood).
- Where does the result go? Only into Files, or onto the product as a new image, and whether it becomes the main one.
Steps
1. Products: the photo
Find the product (find_records on sf_product) and read its images. Each image has a path (its place in Files) and a url.
Hands on: the product's sk, and the photo's path and url.
Check: open the product (/product?openId=<sk>). The photo is the one the person means.
2. Creative Studio library: the photo as an image item
call_appengine POST /creative-studio/assets { "path": "<photo path>", "url": "<photo url>", "name": "<product name>.png" }. This makes a library item of type image: one frame exactly the photo's size, with the photo placed in it when it opens. The answer is 400 if the file can't be read or isn't an image.
If the photo has only a url outside the business's Files, copy it in first with POST /repository/file/upload-url { url, location: "products", name }, then use the path that comes back.
Hands on: the image item's sk.
Check: its card is in the library (/creative-studio), with the photo as its preview.
3. Creative Studio editor: cut out the background
navigate { route: "/creative-studio", params: { uid: "<sk>" } }. Work in the editor's Design AI bar, which sends the canvas and the selection with each request.
Ask the person to click the photo to select it. The AI can't select anything itself. Then call cs_remove_background, or the person presses Remove background (the eraser in the bottom bar). The cut-out replaces the photo in place and is saved in Files. This uses Appmint's own background remover and is not billed as AI image generation.
Check: the tool answered confirmed: true, and the person sees the product with no background.
4. Creative Studio editor: what goes behind it
| They want | How |
|---|---|
| A plain colour | cs_set_background { color: "#ffffff" }. This sets the frame's colour, behind the product. |
| No background (transparent) | cs_set_background { color: "transparent" }, and export as PNG in step 5. |
| A generated scene | cs_generate_image { prompt: "<the scene>", placement: "background" }. The scene covers the frame behind the product. |
| The whole photo reworked | With the photo selected: cs_generate_image { prompt, referenceImage: "selection", replaceSelection: true }. |
Stop: a generated scene or a reworked photo is billed to the business per image (see Service rates), or by their own AI provider if they use their own key. Say what will be generated and that it costs, then wait for yes. One image per yes.
Reworking the photo itself redraws the product. The label, the shape or the colour can come out different. The person must check it closely before it goes on the product. A shop photo that doesn't match the real product misleads buyers. A generated background behind the cut-out keeps the real product as it is.
Then cs_save.
Check: the library card shows the finished picture.
5. Export: the person does it
No tool exports. Ask the person to press Export: one frame, PNG (or JPEG for a smaller file with a solid background), 1× (the photo's own size), saved to Files. The folder is creative-studio/exports unless they change it.
Find the file: call_appengine POST /repository/file/flatlist { "prefix": "creative-studio/exports/" } (keep the trailing slash). Take its path and signedUrl.
Hands on: the file's path and url.
6. Products: the new image
Stop: the product's images show in the shop if the product is published. Show the picture and say where it will go (added, or as the main image) before changing the product. Wait for yes.
update_record { datatype: "sf_product", id: "<sk>", data: { images: [ … ] } }. The new images list replaces the old one. Send every existing image, plus the new one { path, url, contentType: "image/png" }. The shop shows the first image as the main one, so put the new image first only if they said so.
Check: open the product (/product?openId=<sk>). Its images show the new picture, in the right place, and every older one is still there.
When it's done
Tell the person:
- the product, and what was done to the photo (cut out, the background colour, a generated scene);
- whether an image was generated (and billed);
- the file in Files;
- whether the product now shows it, and as which image.
Open the product.
What it can't do yet
- No export by the AI. The person presses Export.
- No selecting. Cutting out and reworking act on what the person selected.
- One photo at a time. There is no batch run for a whole catalogue.
- The original stays in the library. The image item keeps the starting photo as its source. The product's old photo is not changed or removed.
Don'ts
- Don't generate a product from words alone and present it as the product.
- Don't change the product's images without a yes. Don't drop the images already there.
- Don't generate without a yes, or make several versions unless asked.