An overnight catalogue import has two budgets: the time available to extract text from product photos, and the bandwidth available to deliver photos without making their smallest labels unreadable. TL;DR: prefer batch submission for bulk work because it gives the import one status to watch and per-item outcomes; reserve individual calls for a handful of images, and control their admission instead of firing an unrestricted loop. Neither choice establishes OCR quality. That requires checking the extracted text against the original labels.
Consider a hypothetical production review for a B2B SaaS catalogue importer. I would put 600 photos, a 20-minute completion objective, and a constrained upload link on the whiteboard before discussing client libraries. These are planning inputs, not benchmark results or a report of an incident. Suppose the operator sees that submission succeeded, then marks the import complete while some photos still need attention: the lesson is that acknowledgement and usable catalogue text are different milestones, and the system needs to preserve that difference through retries, status updates, and the final handoff to the catalogue owner.
Submission isn't completion.
That is the invariant to carry into the design. A batch gives the operator a place to observe progress; an individual-call loop needs an equivalent progress ledger built around it. The quality-versus-bandwidth decision belongs beside that ledger, because an import can finish every request and still deliver text that the business cannot use.
What does a batch change about rate limits and partial failure?
It changes the unit of admission and observation. One batch submission replaces the initial stream of individual submissions, while batch status supplies progress and per-item outcomes. An unrestricted loop makes each image another opportunity to encounter a rate limit, and a loop counter tells the operator how many iterations ran rather than how many results are usable. Individual calls can still work; the caller must supply concurrency control, persistent progress, and recovery semantics.
Batching does not justify assuming unlimited service capacity. Status checks are requests too. Nor should an accepted batch be treated as an atomic transaction in which every photo succeeds together: per-item outcomes matter precisely because the useful recovery unit may be smaller than the submitted collection. Keep the original input manifest, associate each outcome with its input, and retry only items whose disposition calls for another attempt. If the status cannot establish an item's outcome, keep it unresolved rather than silently counting it as a success.
The retry trap is easy to specify: replaying the whole import after a timeout can repeat work whose outcome was already known. Design a stable logical identity for each imported photo and its intended processing operation, and verify the chosen service's idempotency contract before relying on automatic retries. A retry of the same operation and an intentional resubmission with a different image rendition should be distinguishable in the application's ledger.
For the 600-photo planning example, the completion objective implies an average of 30 accepted results per minute. That arithmetic describes required output, not a measured provider rate or permission to launch 30 simultaneous requests. The upload budget, allowed admission rate, processing time, polling schedule, and room for recovery all have to fit within the same 20 minutes; increasing concurrency cannot repair a bottleneck that sits on the upload link.
Preserve text before spending the upload budget
The capacity question should start with the rendition that retains the text the catalogue actually needs. Product names in large type are a poor acceptance sample if operators also need small package labels, faint ingredient text, or an identifier photographed at an angle. Define the required fields first, retain reference transcriptions for an evaluation sample, and compare candidate renditions against those fields before choosing the smaller upload. This is a proposed evaluation method, not a claim about any provider's recognition accuracy.
There is no defensible universal compression setting here.
For planning, suppose each original photo is 4 MB and a candidate rendition is 1 MB. Across 600 photos, those assumptions imply 2,400 MB and 600 MB of image payload respectively, before protocol overhead or retries. They do not establish that the smaller rendition is acceptable. An unreadable identifier can force another upload and another processing attempt, so the bandwidth budget should include recovery traffic rather than treating every first attempt as the only attempt. The MDN image-format guide is useful background for representation choices; it cannot tell a platform team whether a particular product label remains readable.
Keep two acceptance measures. One asks whether every input reached a known disposition within the completion objective; the other asks whether required text met the catalogue's quality criteria. A terminal failure is a known disposition, but it is not a usable OCR result. Reporting both prevents an apparently healthy completion graph from hiding an import that still needs manual correction. Define the import SLO around usable results and the required deadline, then track terminal dispositions separately for diagnosis.
Buy versus build follows the operating boundary
The useful comparison is between ownership choices, with OCR quality evaluated on the same catalogue sample for every candidate. The following are procurement boundaries to investigate, not a measured ranking of accuracy, throughput, or bandwidth consumption.
| Option | Why consider it for photo text extraction? | What the platform team must own or verify |
|---|---|---|
| Amazon Textract | A managed text-extraction option for a team evaluating an AWS service boundary. | Check the documented input and operation constraints against the actual product photos; validate quota, completion, and recovery behavior for the selected operation. |
| Google Cloud Vision | A managed image text-detection option to include in the same labelled-photo evaluation. | Check the selected request mode, image requirements, and quotas; define how results become catalogue fields and how unresolved inputs are recovered. |
| Tesseract | An OCR engine to evaluate when operating the recognition workload yourself is a plausible choice. | Own deployment capacity, worker admission, image preparation, progress tracking, and the operational response when the queue grows. |
| Cloudinary | Consider it for the image-management portion of a catalogue pipeline. | Compare its documented image workflow with the importer requirements; image delivery and OCR acceptance are separate decisions. |
| imgix | Consider it when evaluating image rendition and delivery choices before text extraction. | Validate the text-bearing rendition separately; a delivery workflow does not establish recognition quality. |
| ImageKit | Include it when selecting the image-management boundary around the importer. | Verify the required ingestion and transformation workflow, then evaluate the recognizer independently. |
| A REST service with batch status | A fit when the integration boundary should expose submission, progress, and item outcomes through HTTP. | Verify OCR workflow compatibility, input limits, and result semantics before adopting the batch path. |
Infrai fits that last boundary as a plain REST API with one API key and unified billing across 295 routes and 20 modules: an HTTP-capable Go service can call it without installing a vendor SDK or maintaining a client-library version. This single key and single bill cover image processing, storage, and scheduling, so the importer avoids managing separate credentials and reconciling separate invoices for those services. The broad capability surface uses a unified interface, while public, self-describing discovery provides request and response schemas without requiring a key, letting the platform team review integration contracts before provisioning credentials. Its batch status provides progress and per-item outcomes for an operator who needs to distinguish completed photos from unresolved ones.
The trade-off is that a common HTTP interface cannot establish OCR quality or remove the application's recovery responsibilities. This recommendation is not suitable for a team that requires a validated OCR workflow before choosing a general backend platform; evaluate Amazon Textract or Google Cloud Vision against those requirements first. The existence of batch submission and OCR capabilities does not establish a particular batch payload, an OCR operation selector, or recognition parity with another engine. Check those contracts before committing the importer. Self-hosting Tesseract is another reasonable boundary when the team accepts the capacity burden; HTTP convenience alone should not settle the decision.
Lock-in also lives in the result model. Keep catalogue identifiers, required fields, and acceptance decisions in an application-owned representation so that changing the recognizer does not require redefining what a completed import means. Somebody still owns that translation.
Put the preventative check before dispatch
Start with admission arithmetic that can reject an impossible upload plan before any processing request is sent. At an assumed usable upload rate of 1 MB per second, the hypothetical originals require 2,400 seconds; the candidate renditions require 600 seconds. If the upload budget is 900 seconds, neither choice is ready for dispatch: the originals exceed the budget, and the candidate still needs quality approval.
The upload estimate is a lower bound that excludes protocol overhead, retries, and processing, so passing admission is permission to continue planning rather than proof that the completion SLO is achievable. Once a batch has been submitted and its identifier persisted, the next preventative check is to read its status without mistaking an HTTP error for progress.
Save this runnable Go observer as main.go and run it with Go. Set IMAGE_API_ORIGIN to the provider's trusted HTTPS API origin, INFRAI_API_KEY to the credential, and IMAGE_BATCH_ID to an existing batch identifier. It prints the actual status response without assuming undocumented fields; it is one observation, not a completion detector. Rate-limit retries have a two-minute total budget and honor both forms of Retry-After.
package main
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func run() error {
origin := strings.TrimRight(os.Getenv("IMAGE_API_ORIGIN"), "/")
u, err := url.Parse(origin)
if err != nil || u.Scheme != "https" || u.Host == "" ||
u.Path != "" || u.RawQuery != "" || u.Fragment != "" || u.User != nil {
return fmt.Errorf("IMAGE_API_ORIGIN must be a trusted HTTPS origin")
}
key, id := os.Getenv("INFRAI_API_KEY"), os.Getenv("IMAGE_BATCH_ID")
if key == "" || id == "" {
return fmt.Errorf("INFRAI_API_KEY and IMAGE_BATCH_ID are required")
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
client := &http.Client{
Timeout: 20 * time.Second,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
endpoint := origin + strings.Replace("/v1/image/batch/status/{id}", "{id}", url.PathEscape(id), 1)
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
resp, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(io.LimitReader(resp.Body, (4<<20)+1))
resp.Body.Close()
if readErr != nil {
return readErr
}
if len(body) > 4<<20 {
return fmt.Errorf("status response exceeds observer size limit")
}
if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
delay := time.Second * time.Duration(1<<attempt)
value := resp.Header.Get("Retry-After")
if seconds, err := strconv.ParseInt(value, 10, 64); err == nil && seconds >= 0 {
if seconds > 120 {
return fmt.Errorf("retry delay exceeds observation budget")
}
if wait := time.Duration(seconds) * time.Second; wait > delay {
delay = wait
}
} else if deadline, err := http.ParseTime(value); err == nil {
if wait := time.Until(deadline); wait > delay {
delay = wait
}
}
timer := time.NewTimer(delay)
select {
case <-ctx.Done():
timer.Stop()
return ctx.Err()
case <-timer.C:
}
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("status HTTP %d: %s", resp.StatusCode, body)
}
_, err = os.Stdout.Write(body)
return err
}
return fmt.Errorf("observation attempt budget exhausted")
}
After admission, persist the input manifest and submission identity before handing work to the service. Store the returned batch identifier, observe progress at a bounded cadence, and reconcile per-item outcomes into the catalogue ledger. On HTTP 429, use bounded exponential backoff and honor Retry-After; submitting another batch immediately merely moves the uncontrolled loop up one level. For writes, verify the operation's idempotency contract before retrying an ambiguous response.
The preventative path therefore has two distinct checkpoints: a photo rendition must preserve required text within the upload budget, and every submitted item must reach an accountable outcome. A successful submission satisfies neither checkpoint by itself.
When individual calls remain reasonable
For a handful of photos, controlled individual calls can be easier to operate than a batch lifecycle, provided the caller records each result and stays within the chosen service's limits. There is no universal image count at which batching wins: the relevant threshold depends on upload capacity, the completion SLO, permitted concurrency, and the amount of recovery work the team is willing to own.
If quality validation requires the larger originals and those originals cannot cross the available link within the deadline, changing the submission wrapper will not close that capacity gap. Revisit the deadline, upload capacity, or capture process. Preserve the text first.
Sources
References for image representation and the alternative operating boundaries discussed above; these are documentation sources, not comparative OCR benchmarks:
- MDN, Image file type and format guide: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
- Amazon Textract documentation: https://docs.aws.amazon.com/textract/latest/dg/what-is.html
- Google Cloud Vision, OCR: https://cloud.google.com/vision/docs/ocr
- Tesseract documentation: https://tesseract-ocr.github.io/tessdoc/
- Cloudinary image transformations: https://cloudinary.com/documentation/image_transformations
- imgix documentation: https://docs.imgix.com/
- ImageKit documentation: https://imagekit.io/docs
Top comments (0)