@ProviderType
public interface Gfx
A Plan
describes the rendering operations.
These follow the
Scene7 Image Serving Protocol. Different Renderer
implementations
can be active and differ in the supported set of operations or input file formats. The best available
renderer will be picked depending on the plan.
Resize an image from the repository and output it as png file:
// build a plan from scratch Plan plan = gfx.createPlan(); // single asset as source (single layer only) plan.layer(0).set("src", "/content/dam/asset.jpg"); Plan.Map view = plan.view(); // define target size view.set("wid", 300); view.set("hei", 200); // png format view.set("fmt", "png"); InputStream in; try { // start rendering in = gfx.render(plan, resourceResolver); // use stream to store in repository or stream as servlet response // ... } finally { // ensure the stream is closed (to clean up temporary files etc.) IOUtils.closeQuietly(in); }
Modifier and Type | Method and Description |
---|---|
Plan |
createPlan()
Create an empty plan that can be set up from scratch.
|
java.io.InputStream |
render(Plan plan,
ResourceResolver resolver)
Renders the given plan and returns a binary file stream, typically an
image file format, depending on the plan.
|
Plan createPlan()
java.io.InputStream render(Plan plan, ResourceResolver resolver)
plan
- describes the rendering operationsresolver
- a resource resolver to access files referenced in the plannull
will be returned.Copyright © 2010 - 2020 Adobe. All Rights Reserved