Add Image Optimization Support
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the WIT bindings in stubs/wit_world/imports/image_optimizer.py and inspect the unsupported implementations in src/component/image_optimizer.rs and src/wiggle_abi/image_optimizer.rs. Compare the requested wrapper shape with the Rust and JavaScript APIs, then add coverage for parameter validation, type conversions, and Unsupported errors; done means the documented API exists and its tests pass without requiring Viceroy support.
Written by the indexing model from the issue text.
Description
Overview
Add support for Fastly's Image Optimizer API, enabling on-the-fly image transformation and optimization.
WIT Interface
interface image-optimizer {
use http-body.{body};
use http-req.{request};
use http-resp.{response-with-body};
use types.{error};
use backend.{backend};
resource extra-image-optimizer-transform-options;
record image-optimizer-transform-options {
sdk-claims-opts: option<string>,
extra: option<borrow<extra-image-optimizer-transform-options>>,
}
transform-image-optimizer-request: func(origin-image-request: borrow<request>, origin-image-request-body: option<body>, origin-image-request-backend: borrow<backend>, io-transform-options: image-optimizer-transform-options) -> result<response-with-body, error>;
}
WIT bindings: stubs/wit_world/imports/image_optimizer.py
API Design
- Simple function-based API:
transform_image(request, body, backend, options) ImageOptimizerOptionsdataclass for transformation parameters- Returns tuple of
(Response, Body)with optimized image - Body should be
io.IOBase-compatible for streaming large images - Supports query parameter-based transformations (width, height, format, quality, etc.)
- Integration with Backend and Request/Response APIs
Cross-SDK Comparison: Rust has transform_image_optimizer_request(), JS has similar. Go support may vary. This is a specialized/premium feature - Python wrapper should match Rust's approach with transform function accepting request, backend, and options.
Viceroy Testing
Image Optimizer is NOT supported in Viceroy. The implementation returns Error::Unsupported for all calls (src/component/image_optimizer.rs:14, src/wiggle_abi/image_optimizer.rs:18).
Tests should:
- Verify the API wrapper exists and accepts correct parameters
- Skip or mark as expected to fail any tests that actually call
transform_image_optimizer_request() - Focus on testing parameter validation, type conversions, and error handling for
Unsupportederrors
This API is primarily testable in production or staging environments.
Reference
- Dominant language
- Python
- Stars
- 5
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fastly/compute-sdk-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
fastly/compute-sdk-python#116 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
fastly/compute-sdk-python#98 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
fastly/compute-sdk-python#74 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
fastly/compute-sdk-python#61 ·
-
fastly/compute-sdk-python#60 · 1 assignee ·
All issues in fastly/compute-sdk-python
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
canonical/paas-charm#368 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
StevenBlack/hosts#3256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
qualcomm/qai-appbuilder#275 ·