Class ImageEditParams.Image
-
- All Implemented Interfaces:
public final class ImageEditParams.ImageThe image(s) to edit. Must be a supported image file or an array of images.
For the GPT image models (
gpt-image-1,gpt-image-1-mini,gpt-image-1.5,gpt-image-2,gpt-image-2-2026-04-21, andchatgpt-image-latest), each image should be apng,webp, orjpgfile less than 50MB. You can provide up to 16 images.For
dall-e-2, you can only provide one image, and it should be a squarepngfile less than 4MB.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceImageEditParams.Image.VisitorAn interface that defines how to map each variant of Image to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<InputStream>inputStream()final Optional<List<InputStream>>inputStreams()final BooleanisInputStream()final BooleanisInputStreams()final InputStreamasInputStream()final List<InputStream>asInputStreams()final Optional<JsonValue>_json()final <T extends Any> Taccept(ImageEditParams.Image.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ImageEditParams.Imagevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ImageEditParams.ImageofInputStream(InputStream inputStream)final static ImageEditParams.ImageofInputStreams(List<InputStream> inputStreams)-
-
Method Detail
-
inputStream
final Optional<InputStream> inputStream()
-
inputStreams
final Optional<List<InputStream>> inputStreams()
-
isInputStream
final Boolean isInputStream()
-
isInputStreams
final Boolean isInputStreams()
-
asInputStream
final InputStream asInputStream()
-
asInputStreams
final List<InputStream> asInputStreams()
-
accept
final <T extends Any> T accept(ImageEditParams.Image.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = image.accept(new Image.Visitor<Optional<String>>() { @Override public Optional<String> visitInputStream(InputStream inputStream) { return Optional.of(inputStream.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ImageEditParams.Image validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofInputStream
final static ImageEditParams.Image ofInputStream(InputStream inputStream)
-
ofInputStreams
final static ImageEditParams.Image ofInputStreams(List<InputStream> inputStreams)
-
-
-
-