https://github.com/inukshuk/rdjpgcom.js
Read text comments from JPEG files
https://github.com/inukshuk/rdjpgcom.js
Last synced: 7 months ago
JSON representation
Read text comments from JPEG files
- Host: GitHub
- URL: https://github.com/inukshuk/rdjpgcom.js
- Owner: inukshuk
- License: bsd-2-clause
- Created: 2023-01-31T13:28:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-02T10:51:24.000Z (over 2 years ago)
- Last Synced: 2025-02-14T01:05:27.138Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 66.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rdjpgcom.js
===========
[](https://github.com/inukshuk/rdjpgcom.js/actions/workflows/ci.yml)Read text comments from JPEG files using pure JavaScript.
Inspired by the CLI tool of the same name,
included in the Independet JPEG Group's [jpegtran][].[jpegtran]: https://www.ijg.org
Installation
------------
npm install rdjpgcomUsage
-----
import { readFile } from 'node:fs/promises'
import { rdjpgcom } from 'rdjpgcom'let buffer = await readFile('image.jpg')
// To read all valid UTF-8 comments:
let comments = rdjpgcom(buffer)
// You can pass a different encoding as an option.// To see all comment segments and their raw `payload` buffers use:
for (let segment of rdjpgcom(buffer, { encoding: null })) {
segment.payload
}Acknowledgements
----------------
This module is a derived work inspired by `rdjpgcom.c` andCopyright (C) 1994-1997, Thomas G. Lane.
Modified 2009 by Bill Allombert, Guido VollbedingLicense
-------
rdjpgcom.js is licensed under the terms of the BSD-2-Clause license.
See the LICENSE file for details.