std.image.awt.common
image
added in 3.0
(image {:keys [size model data], :as m})(image size model data)creates a Bufferedimage from a map
(image {:size 2 2 :model :byte-gray :data (byte-array 10 20 30 40)}) ;;=> #img2 2{:type java.awt.image.BufferedImage, :model :byte-gray}
image-channels
added in 3.0
(image-channels img)returns the channels for the image
(->> (image {:size 2 2 :model :byte-gray :data (byte-array 10 20 30 40)}) (image-channels) (mapv vec)) => 10 20 30 40
image-data
added in 3.0
(image-data img)returns the data contained within the BufferedImage
(-> (image {:size 2 2 :model :byte-gray :data (byte-array 10 20 30 40)}) (image-data) (vec)) => 10 20 30 40
image-model
added in 3.0
(image-model img)returns the model associated with the BufferedImage
(-> (image {:size 2 2 :model :byte-gray :data (byte-array 10 20 30 40)}) (image-model)) => (contains-in {:type :gray :meta {:type Byte/TYPE :span 1}, :data {:raw {:type Byte/TYPE, :channel 0, :index 0}}, :label :byte-gray :channel {:count 1}})
image-size
added in 3.0
(image-size img)returns the size of the BufferedImage
(-> (image {:size 2 2 :model :byte-gray :data (byte-array 10 20 30 40)}) (image-size)) => {:height 2, :width 2}
image-to-byte-gray
added in 3.0
(image-to-byte-gray img)returns the data with data in gray
(-> (image {:size 4 4 :model :byte-gray :data (byte-array 10 20 30 40 10 20 30 40 10 20 30 40 10 20 30 40)}) (image-to-byte-gray) (vec)) => 10 20 30 40 10 20 30 40 10 20 30 40 10 20 30 40
image-to-int-argb
added in 3.0
(image-to-int-argb img)returns the data associated with argb
(->> (image {:size 2 2 :model :byte-gray :data (byte-array 10 20 30 40)}) (image-to-int-argb) (mapv util/int->bytes)) => [255 10 10 10 255 20 20 20 255 30 30 30 255 40 40 40]
subimage
added in 3.0
(subimage img x y w h)returns the subimage of the image
(-> (image {:size 4 4 :model :byte-gray :data (byte-array 10 20 30 40 10 20 30 40 10 20 30 40 10 20 30 40)}) (subimage 1 1 2 2) (image-data) vec) => 20 30 20 30