Liking cljdoc? Tell your friends :D

fivetonine.collage.core


cropclj

(crop image x y width height)

Crops an image.

x, y are the coordinates to top left corner of the area to crop. width, height are the width and height of the area to crop.

The returned image does not share its data with the original image.

Crops an image.

`x, y` are the coordinates to top left corner of the area to crop.
`width, height` are the width and height of the area to crop.

The returned image does not share its data with the original image.
sourceraw docstring

flipclj

(flip image direction)

Flips an image.

If direction is :horizontal, flips the image around the y-axis.

If direction is :vertical, flips the image around the x-axis.

Flips an image.

If direction is `:horizontal`, flips the image around the y-axis.

If direction is `:vertical`, flips the image around the x-axis.
sourceraw docstring

normalise-angleclj

(normalise-angle theta)

Restrict the rotation angle to the range [-360..360].

Restrict the rotation angle to the range [-360..360].
sourceraw docstring

not-nil?clj

source

pasteclj

(paste image & layer-defs)

Pastes layer(s) onto image at coordinates x and y.

layer-defs is expected to in the format

[layer1 x1 y2 layer2 x2 y2 ... ]

Layers are loaded using fivetonine.collage.util/load-image. Top left corner of a layer will be at x, y.

Throws IllegalArgumentException if the number of elements in the list of layers and coordinates is not divisible by 3.

Returns the resulting image.

Pastes layer(s) onto image at coordinates `x` and `y`.

`layer-defs` is expected to in the format

  [layer1 x1 y2 layer2 x2 y2 ... ]

Layers are loaded using `fivetonine.collage.util/load-image`.
Top left corner of a layer will be at `x, y`.

Throws `IllegalArgumentException` if the number of elements in the list of
layers and coordinates is not divisible by 3.

Returns the resulting image.
sourceraw docstring

paste*clj

(paste* base [layer x y])

Paste layer on top of base at position x, y and return the resulting image. Used as an internal function by paste.

Paste layer on top of base at position `x, y` and return the resulting image.
Used as an internal function by `paste`.
sourceraw docstring

resizeclj

(resize image & {:keys [width height] :as opts})

Resizes an image.

If only width or height is provided, the resulting image will be width or height px wide, respectively. The other dimension will be calculated automatically to preserve width/height ratio.

With width and height both provided, the resulting image will be crudely resized to match the provided values.

If neither width nor height are provided, IllegalArgumentException is thrown.

Examples:

(resize image :width 100) (resize image :height 300) (resize image :width 100 :height 300)

Resizes an image.

If only `width` or `height` is provided, the resulting image will be `width`
or `height` px wide, respectively. The other dimension will be calculated
automatically to preserve `width/height` ratio.

With `width` and `height` both provided, the resulting image will be crudely
resized to match the provided values.

If neither `width` nor `height` are provided, `IllegalArgumentException` is
thrown.

Examples:

  (resize image :width 100)
  (resize image :height 300)
  (resize image :width 100 :height 300)
sourceraw docstring

resize*clj

(resize* image width height)

Resize the given image to width and height. Used as an internal function by resize.

Note: the method of resizing may change in the future as there are better, iterative, solutions to balancing speed vs. quality. See the perils of Image.getScaledInstance().

Resize the given image to `width` and `height`.
Used as an internal function by `resize`.

Note: the method of resizing may change in the future as there are better,
iterative, solutions to balancing speed vs. quality. See
[the perils of Image.getScaledInstance()](https://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html).
sourceraw docstring

rotateclj

(rotate image theta)

Rotates image through angle theta, where theta is an integer multiple of 90.

If theta > 0, the image is rotated clockwise.

If theta < 0, the image is rotated anticlockwise.

Rotates image through angle `theta`, where `theta` is
an integer multiple of 90.

If `theta > 0`, the image is rotated clockwise.

If `theta < 0`, the image is rotated anticlockwise.
sourceraw docstring

scaleclj

(scale image f)

Scales an image by a factor f.

If 0.0 < f < 1.0 the image is scaled down.

If f > 1.0 the image is scaled up.

Scales an image by a factor `f`.

If `0.0 < f < 1.0` the image is scaled down.

If `f > 1.0` the image is scaled up.
sourceraw docstring

with-imagecljmacro

(with-image image-resource & operations)

A helper for applying multiple operations to an image.

image-resource can be a String, a File or a BufferedImage.

Example:

(with-image "/path/to/image.jpg" (scale 0.8) (rotate 90) (crop 0 0 100 100))

Expands to (properly namespaced):

(let [image__2336__auto__ (load-image "/path/to/image.jpg")] (clojure.core/-> image__2336__auto__ (scale 0.8) (rotate 90) (crop 0 0 100 100)))

Returns the image which is the result of applying all operations to the input image.

A helper for applying multiple operations to an image.

`image-resource` can be a `String`, a `File` or a `BufferedImage`.

Example:

  (with-image "/path/to/image.jpg"
               (scale 0.8)
               (rotate 90)
               (crop 0 0 100 100))

Expands to (properly namespaced):

  (let [image__2336__auto__ (load-image "/path/to/image.jpg")]
    (clojure.core/-> image__2336__auto__
                     (scale 0.8)
                     (rotate 90)
                     (crop 0 0 100 100)))

Returns the image which is the result of applying all operations to the input
image.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close