stream — Create encoded image stream

    Encodes the current image in given format and given image quality and creates new PSR-7 stream based on image data.

    • jpg — return JPEG encoded image data
    • png — return Portable Network Graphics (PNG) encoded image data
    • tif — return Tagged Image File Format (TIFF) encoded image data
    • bmp — return Bitmap (BMP) encoded image data
    • data-url — encode current image data in data URI scheme (RFC 2397)

    By default the method will return data encoded in the type of the current image. If no image type is defined yet, data will be encoded as jpeg.

    quality (optional)

    as instance of .