tech.v3.libs.buffered-image

Bindings to buffered images for the datatype system

as-ubyte-tensor

(as-ubyte-tensor img & _options)

Get the buffered image as a uint8 tensor. Works for byte and integer-buffer backed images.

buffered-image->data-buffer

(buffered-image->data-buffer img)

Given a buffered image, return it's data buffer.

clone

(clone src-img)

Clone an image into a new buffered image.

downsample-bilinear

(downsample-bilinear src-img & {:keys [dst-img-width dst-img-height dst-img-type]})

Reduce an image size using bilinear filtering.

draw-image!

(draw-image! src-img dst-image & {:keys [src-x-offset src-y-offset src-rect-width src-rect-height dst-x-offset dst-y-offset dst-rect-width dst-rect-height interpolation-type]})

Draw a source image onto a destination image. This can be used for scaling, cropping, or copying images.

image-channel-format

(image-channel-format img)

Get the image channel format of the buffered image. Formats returned may be: :gray :bgr :rgb :abgr :argb :abgr-pre :argb-pre

image-channel-map

(image-channel-map img)

Get a map from keyword channel name to channel index in a ubyte tensor

image-type

(image-type img)

Get the image type of a buffered image as a keyword.

image-types

Mapping from keywords to integer buffered image types

interpolation-types

Map of keyword to buffered image rendering hint.

load

(load fname-or-stream)

Load an image. There are better versions of this in tech.io

new-image

(new-image height width img-type)

Create a new buffered image. img-type is a keyword and must be one of the keys in the image-types map. ** Arguments are reverse of the buffered image constructor **

PDataBufferAccess

protocol

members

data-buffer-banks

(data-buffer-banks item)

resize

(resize src-img new-width new-height {:keys [resize-algorithm dst-img-type]})

Resize an image. Options -

  • resize-algorithm - One of #{:bilinear :cubic :nearest}. Defaults to - if the new width is larger than then old width, bilinear is chosen else nearest is chosen.
  • dst-img-type - Defaults to the src image type. Should be one of the keys of image-types.

save!

(save! img format-str fname-or-stream)(save! img fname-str)

Save an image. Format-str can be things like "PNG" or "JPEG". There are better versions of this in tech.io.