Integer contain and centered-cover geometry for Clojure and ClojureScript. This namespace never reads, modifies, or uploads image files.
Integer contain and centered-cover geometry for Clojure and ClojureScript. This namespace never reads, modifies, or uploads image files.
(contain source bounds)(contain source bounds allow-upscale?)Fit the whole source inside bounds. The non-limiting dimension rounds down. With allow-upscale? false (the default), an already-fitting source is unchanged. Throws ExceptionInfo (Error in JS) with a namespaced :type on invalid input or a result that would round to zero pixels.
Fit the whole source inside bounds. The non-limiting dimension rounds down. With allow-upscale? false (the default), an already-fitting source is unchanged. Throws ExceptionInfo (Error in JS) with a namespaced :type on invalid input or a result that would round to zero pixels.
(cover source target)(cover source target allow-upscale?)Plan a resize followed by a centered crop that fills target. Returns {:resized {:width ... :height ...} :crop {:x ... :y ... :width ... :height ...}}. Crop coordinates refer to the RESIZED image. The non-limiting dimension rounds up; an odd extra removed pixel lies on the right or bottom. Throws ::upscaling-required if filling target requires enlargement while allow-upscale? is false (the default).
Plan a resize followed by a centered crop that fills target.
Returns {:resized {:width ... :height ...}
:crop {:x ... :y ... :width ... :height ...}}.
Crop coordinates refer to the RESIZED image. The non-limiting dimension
rounds up; an odd extra removed pixel lies on the right or bottom.
Throws ::upscaling-required if filling target requires enlargement while
allow-upscale? is false (the default).Largest accepted input or output dimension, in pixels. This bound keeps cross-products exact in JavaScript as well as on the JVM.
Largest accepted input or output dimension, in pixels. This bound keeps cross-products exact in JavaScript as well as on the JVM.
(size width height)Return {:width width :height height}. Both dimensions must be integers from 1 through max-dimension.
Return {:width width :height height}.
Both dimensions must be integers from 1 through max-dimension.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |