Liking cljdoc? Tell your friends :D

ol.vips

Load, transform, and write images with libvips from Clojure.

ol.vips exposes the runtime, I/O, metadata, and animated-image helpers that most applications use directly. Loaders such as from-file, from-buffer, and from-stream return closeable image handles. Operations return new image handles rather than mutating the original image, and sinks such as write-to-file, write-to-buffer, and write-to-stream trigger evaluation of the underlying libvips pipeline.

Guides and API reference live at https://docs.outskirtslabs.com/ol.vips/next/.

Use this namespace for:

  • runtime initialization and safety controls
  • file, buffer, and stream input/output
  • metadata and raw header access
  • animated-image metadata and frame-aware helpers
  • low-level generic operation calls with call

Related Namespaces

Example

(require '[ol.vips :as v]
         '[ol.vips.operations :as ops])

(v/init!)

(with-open [thumb   (ops/thumbnail "dev/rabbit.jpg" 300 {:auto-rotate true})
            rotated (ops/rotate thumb 90.0)]
  (v/write-to-file rotated "thumbnail.jpg")
  (v/metadata rotated))
;; => {:width 300, :height 242, :bands 3, :has-alpha? false}
Load, transform, and write images with libvips from Clojure.

`ol.vips` exposes the runtime, I/O, metadata, and animated-image helpers that
most applications use directly. Loaders such as [[from-file]],
[[from-buffer]], and [[from-stream]] return closeable image handles.
Operations return new image handles rather than mutating the original image,
and sinks such as [[write-to-file]], [[write-to-buffer]], and
[[write-to-stream]] trigger evaluation of the underlying libvips pipeline.

Guides and API reference live at https://docs.outskirtslabs.com/ol.vips/next/.

Use this namespace for:

- runtime initialization and safety controls
- file, buffer, and stream input/output
- metadata and raw header access
- animated-image metadata and frame-aware helpers
- low-level generic operation calls with [[call]]

## Related Namespaces

- [[ol.vips.operations]] for generated wrappers around the libvips operation surface
- [[ol.vips.enums]] for normalized enum keywords and enum value sets

## Example

```clojure
(require '[ol.vips :as v]
         '[ol.vips.operations :as ops])

(v/init!)

(with-open [thumb   (ops/thumbnail "dev/rabbit.jpg" 300 {:auto-rotate true})
            rotated (ops/rotate thumb 90.0)]
  (v/write-to-file rotated "thumbnail.jpg")
  (v/metadata rotated))
;; => {:width 300, :height 242, :bands 3, :has-alpha? false}
```
raw docstring

ol.vips.codegen

Generate the introspected wrapper namespaces for ol.vips.

This namespace queries the live libvips runtime through ol.vips and [[ol.vips.impl.introspect]], then writes the generated public wrapper files:

  • src/ol/vips/enums.clj
  • src/ol/vips/operations.clj

The generated files are derived from the currently loaded libvips build, so run this from a development environment where ol.vips can initialize its native libraries.

Usage:

(require '[ol.vips.codegen :as codegen])

(codegen/generate!)
;;=> {:enum-count 42
;;    :operation-count 233
;;    :skipped-count 57
;;    :paths ["src/ol/vips/enums.clj"
;;            "src/ol/vips/operations.clj"]}

In the ol.vips code repo the babashka task bb codegen is the normal project entry point for this namespace.

Generate the introspected wrapper namespaces for `ol.vips`.

This namespace queries the live libvips runtime through [[ol.vips]] and
[[ol.vips.impl.introspect]], then writes the generated public wrapper files:

- `src/ol/vips/enums.clj`
- `src/ol/vips/operations.clj`

The generated files are derived from the currently loaded libvips build, so
run this from a development environment where `ol.vips` can initialize its
native libraries.

Usage:

```clojure
(require '[ol.vips.codegen :as codegen])

(codegen/generate!)
;;=> {:enum-count 42
;;    :operation-count 233
;;    :skipped-count 57
;;    :paths ["src/ol/vips/enums.clj"
;;            "src/ol/vips/operations.clj"]}
```

In the ol.vips code repo the babashka task `bb codegen` is the normal project entry point for this
namespace.
raw docstring

ol.vips.enums

Generated enum descriptors for normalized libvips enum ids.

Use registry or the generated enum vars to inspect enum metadata. Use ol.vips/encode-enum and ol.vips/decode-enum to convert between keywords and the underlying libvips integer values.

Generated enum descriptors for normalized libvips enum ids.

Use [[registry]] or the generated enum vars to inspect enum metadata. Use [[ol.vips/encode-enum]] and [[ol.vips/decode-enum]] to convert between keywords and the underlying libvips integer values.
raw docstring

ol.vips.operations

Generated libvips operation wrappers keyed by normalized operation id.

Inspect registry directly for generated operation metadata, then call the generated wrapper vars directly for typed access to supported libvips operations.

Generated libvips operation wrappers keyed by normalized operation id.

Inspect [[registry]] directly for generated operation metadata, then call the generated wrapper vars directly for typed access to supported libvips operations.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close