# Class ImagePart

java.lang.Object
com.codename1.ai.MessagePart
com.codename1.ai.ImagePart

public final class ImagePart extends MessagePart
An image attachment for a multi-modal `ChatMessage`. Construct from raw bytes (the provider encodes them as base64 inline data) or from a publicly-reachable URL -- both modes are accepted by OpenAI, Anthropic, and Gemini.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ImagePart(byte[] data, String mimeType)`
  Inline image bytes.
  `ImagePart(String url)`
  Remote image by URL.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `getData()`
  `String`
  `getMimeType()`
  `String`
  `getUrl()`
  `boolean`
  `isUrl()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ImagePart

    public ImagePart(byte[] data, String mimeType)
    Inline image bytes. `mimeType` must be set (e.g. `"image/png"`, `"image/jpeg"`); the providers reject inline images without it.

  - ### ImagePart

    public ImagePart(String url)
    Remote image by URL. Only HTTPS is portable across providers.

- ## Method Details

  - ### getData

    public byte[] getData()

  - ### getMimeType

    public String getMimeType()

  - ### getUrl

    public String getUrl()

  - ### isUrl

    public boolean isUrl()