Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataFrame
  • PyFlink Multimodal
    • Image
    • Video
    • Utilities
  • PyFlink DataStream
  • PyFlink Common

pyflink.multimodal.operators.image_decode#

image_decode(*columns, on_error='raise', mode=None, pixel_limit=None, concurrency=None)[source]#

Decode encoded image bytes into a decoded image.

This is the pipeline entry point for image data quality handling.

Parameters
  • *columns – Optional image columns. When provided, the UDF is applied directly instead of returning a factory.

  • on_error – Handling strategy for corrupt or undecodable images: - "raise" (default): raise an exception and stop processing. - "null": output null so downstream operators skip the row.

  • mode – Optional target mode to convert to, e.g. “RGB” or “L16”. None preserves the decoded mode when it can be represented. Set mode="RGB" explicitly before model operators that require normalized RGB input.

  • pixel_limit – Decompression bomb guard. A small compressed file can expand to billions of pixels and OOM the TaskManager. When set, image dimensions are read from the file header (zero-decode cost) and images with width * height > pixel_limit are rejected before any pixel allocation. Follows the on_error strategy: raises on "raise", returns null on "null". None (default) falls back to PIL’s global MAX_IMAGE_PIXELS (~178 million).

  • concurrency – UDF concurrency. None uses the framework default.

Returns

A UDF producing decoded image values.

Example::
>>> # As a reusable variable
>>> decode = image_decode(on_error="null")
>>> df = df.with_columns("img", decode(col("raw_bytes")))
>>>
>>> # Inline
>>> df = df.with_columns("img", image_decode(col("raw_bytes"), on_error="null"))

previous

Image

next

pyflink.multimodal.operators.image_encode

Show Source

Created using Sphinx 4.5.0.