std.image

*default-model*

dynamic

*default-type*

dynamic

*default-view*

dynamic

blank

added in 3.0

(blank size)(blank size model)(blank size model type)

returns a blank image

(image/blank 10 10) ;;#image.awt10 10{:model :int-argb} => java.awt.image.BufferedImage

coerce

added in 3.0

(coerce image type)(coerce image to-model type)

coerces one image to another

(-> (image/read “test-data/std.image/circle-30.png”) (image/coerce :base)) ;; #image.base30 30{:model :4-byte-abgr} => std.image.base.Image

default-model

added in 3.0

(default-model)(default-model v)

displays and set the default model

(:label (default-model)) => :int-argb

default-type

added in 3.0

(default-type)(default-type v)

displays and sets the default type

(default-type std.image.base.Image)

(default-type java.awt.image.BufferedImage)

(default-type) => java.awt.image.BufferedImage

default-view

added in 3.0

(default-view)(default-view v)

displays and set the default view

(default-view) => :awt

display

added in 3.0

(display image)(display image opts)(display image opts type)

displays an image

(-> (image/read “test-data/std.image/circle-10.png”) (display {:channel :red} :base))

display-class

added in 3.0

(display-class type)

shows which types can be displayed

(display-class :base) => #{std.image.base.Image}

(display-class :awt) => #{java.awt.image.BufferedImage}

height

added in 3.0

(height obj)

returns the height of an image

(-> (image/read “test-data/std.image/circle-30.png”) (image/height)) => 30

image

added in 3.0

(image {:keys [size model data type]})(image size model data)(image size model data type)

creates an image given parameters

(image {:size 2 2 :model :byte-gray :data (byte-array 1 2 3 4)}) ;;#image.awt2 2{:model :byte-gray} => default-type

image-channels

added in 3.0

(image-channels image)

returns the channels of an image

(-> (image/read “test-data/std.image/circle-30.png”) (image-channels)) ;;[#object[“[B” 0x76926cfc "B@76926cfc"]

image-data

added in 3.0

(image-data image)

returns the raw data associated with the image

(->> (image/read “test-data/std.image/circle-30.png”) (image-data) (take 10)) => -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

image-model

added in 3.0

(image-model image)

returns the model associated with the image

(-> (image/read “test-data/std.image/circle-30.png”) (image-model)) => (model/model :4-byte-abgr)

image-size

added in 3.0

(image-size image)

returns the size of the image

(-> (image/read “test-data/std.image/circle-30.png”) (image-size)) => {:height 30, :width 30}

image?

added in 3.0

(image? obj)

checks whether object is an image

(image? (image/read “test-data/std.image/circle-30.png”)) => true

read

added in 3.0

(read source)(read source model)(read source model type)

reads an image from file

(image/read “test-data/std.image/circle-30.png” (model/model :byte-gray) :base) ;;#image.base30 30{:model :byte-gray} => std.image.base.Image

size?

added in 3.0

(size? obj)

checks whether object is a size

(size? 10 10) => true

(size? {:height 10 :width 10}) => true

subimage

added in 3.0

(subimage image x y w h)

returns a subimage given image and bounds (-> (image/read “test-data/std.image/circle-30.png”) (subimage 10 10 10 10) (image-size)) ;; #image.awt10 10{:model :4-byte-abgr} => {:height 10, :width 10}

to-byte-gray

added in 3.0

(to-byte-gray image)

converts an image :byte-gray representation

(-> (image/read “test-data/std.image/circle-30.png”) (to-byte-gray)) ;;#object[“[B” 0x2c1a4f3 "B@2c1a4f3"

to-int-argb

added in 3.0

(to-int-argb image)

converts an image :int-argb representation

(-> (image/read “test-data/std.image/circle-30.png”) (to-int-argb)) ;;#object[“[I” 0x3514a0dc "I@3514a0dc"

width

added in 3.0

(width obj)

returns the width of an image

(-> (image/read “test-data/std.image/circle-30.png”) (image/width)) => 30

write

added in 3.0

(write image sink)(write image sink opts)

writes an image to file

(-> (image/read “test-data/std.image/circle-30.png”) (image/coerce (model/model :3-byte-bgr) :base) (image/write “test-data/std.image/circle-30.jpg” {:format “JPG”}))