https://github.com/danielsz/beeld
Get the metadata associated with an image. Also contains image utilities: filesize, scale, etc.
https://github.com/danielsz/beeld
clojars clojure exif metadata
Last synced: 6 months ago
JSON representation
Get the metadata associated with an image. Also contains image utilities: filesize, scale, etc.
- Host: GitHub
- URL: https://github.com/danielsz/beeld
- Owner: danielsz
- License: epl-2.0
- Created: 2025-03-03T19:20:15.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-06-24T07:05:10.000Z (6 months ago)
- Last Synced: 2025-07-03T00:36:57.038Z (6 months ago)
- Topics: clojars, clojure, exif, metadata
- Language: Clojure
- Homepage: https://lewicz.art/the-haikou-diaries
- Size: 32.2 KB
- Stars: 16
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
[[https://clojars.org/com.github.danielsz/beeld/latest-version.svg]]
* Beeld
This library displays the metadata associated with images and does
some more.
** Metadata
Image formats embed standardized information about
themselves. Multiple information standards may coexist in the same
image, for example Exif, IPTC, ICC and XMP. The Exif standard specify
a special tag called /Makernote/ that allows camera manufactures to add
their proprietary tags.
Over the years, software solutions for retrieving and preserving
metadata have coalesced around a handful of flagship projects with
Phil Harvey's [[Exiftool][Exiftool]] reigning supreme. For Java, the go-to solution
is Drew Noakes's [[https://github.com/drewnoakes/metadata-extractor][metadata extractor]]. This library depends on the
latter.
Two namespaces are meant for public consumption, ~beeld.core~ and
~beeld.metadata~.
** beeld.metadata
Most users will need only the ~tags~ function, which accepts a filename
and returns a data structure reflecting the metadata associated with
the image. Since images may have large amounts metadata, the data
structure, a map of maps, is organized around standardized
directories. Think about them as thematic groupings of
information. Examples of such headings are ~Exif SubIFD~, ~File Type~,
~GPS~, etc.
The argument to ~tags~ are the same arguments that ~input-stream~ accepts:
/InputStream/, /File/, /URI/, /URL/, byte array, strings. A string argument
gets first resolved as a /URI/, then as a local file name. This means
that you can ask about the metadata of images over the wire.
#+begin_src clojure
(require '[beeld.metadata :as meta])
(meta/tags "path/to/your/image.jpg")
;;or
(meta/tags "https://somewhere.com/your/image.jpg")
;; Returns a map of maps
#+end_src
The namespace ~beeld.metadata~ offers several convenience functions that
retrieve a particular metadata tag, for example ~mime-type~, ~lens~, ~make~,
~orientation~, etc.
** beeld.core
~beeld.core~ defines an interface geared towards low-level image
manipulation. The namespace includes functions to convert images to
base64, streams or byte arrays, very much in the spirit of Java
I/O. The ~scale~ function in /beeld.core/ will honor the orientation tag
found in the metada and resize the image accordingly. Something that
Java's /ImageIO/ doesn't do.
** Contributing
Additional convenience functions in the ~beeld.metadata~ namespace are
welcome. Anything else requires preliminary discussion and vetting.