vllm.multimodal.image
¶
Functions:
-
get_image_id_bytes–Return the EXIF
ImageIDof an image as a UUID, if it carries one. -
normalize_image–Normalize EXIF orientation so the pixel data matches visual display.
-
rescale_image_size–Rescale the dimensions of an image by a constant factor.
-
rgba_to_rgb–Convert an RGBA image to RGB with filled background color.
_has_transparency(image)
¶
Detect whether an image carries transparency data (RGBA, LA, PA, or tRNS chunk in P/L/RGB PNGs).
Source code in vllm/multimodal/image.py
get_image_id_bytes(image)
¶
Return the EXIF ImageID of an image as a UUID, if it carries one.
An ImageID identifies the logical image, so callers use it as the cache
identity: the same image under different encodings, dimensions or
quantization then shares one entry. Malformed EXIF (e.g. an invalid TIFF
header) yields None instead of raising, leaving the caller to fall back
to the encoded bytes.
Only pass an image whose pixels are already decoded or whose header was
parsed without decoding: getexif() rasterizes a PNG that has no exif
entry in info (a trailing eXIf chunk is only findable by reading to EOF).
Source code in vllm/multimodal/image.py
normalize_image(image)
¶
Normalize EXIF orientation so the pixel data matches visual display.
rescale_image_size(image, size_factor, transpose=-1)
¶
Rescale the dimensions of an image by a constant factor.
Source code in vllm/multimodal/image.py
rgba_to_rgb(image, background_color=(255, 255, 255))
¶
Convert an RGBA image to RGB with filled background color.