https://github.com/stumpycr/stumpy_jpeg
Read JPEG images in pure Crystal
https://github.com/stumpycr/stumpy_jpeg
crystal image-processing jpeg
Last synced: 8 months ago
JSON representation
Read JPEG images in pure Crystal
- Host: GitHub
- URL: https://github.com/stumpycr/stumpy_jpeg
- Owner: stumpycr
- License: mit
- Created: 2019-01-09T11:26:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-24T14:41:46.000Z (over 6 years ago)
- Last Synced: 2025-04-07T12:11:54.145Z (12 months ago)
- Topics: crystal, image-processing, jpeg
- Language: Crystal
- Size: 105 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stumpy_jpeg
WORK IN PROGRESS
Read sequential and progressive JPEGs.
* Does not support arithmetic encoding.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
stumpy_jpeg:
github: reiswindy/stumpy_jpeg
```
2. Run `shards install`
## Interface
* `StumpyJPEG.read(file : String) : Canvas` reads a JPEG image from a file
* `StumpyJPEG.read(io : IO) : Canvas` reads a JPEG image from an IO
* `StumpyJPEG::JPEG` holds image associated data during parsing
## Usage
```crystal
require "stumpy_jpeg"
canvas = StumpyJPEG.read("yamboli.jpg")
```
For progressive reading
```crystal
require "stumpy_jpeg"
StumpyJPEG.read("yamboli.jpg") do |canvas|
r, g, b = canvas[0, 0].to_rgb8
puts "red=#{r}, green=#{g}, blue=#{b}"
end
```
## To Do / Wishlist
- [ ] JFIF header parsing support
- [x] Downsampled image support
- [ ] Arithmetic encoding support
- [ ] Add more tests
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [reiswindy](https://github.com/reiswindy) - creator and maintainer