Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
plugins: [Styler],
inputs: [
"{mix,.formatter}.exs",
"{lib,test,bench}/**/*.{ex,exs}"
"{lib,bench}/**/*.{ex,exs}"
| ["test/**/*.{ex,exs}"]
|> Enum.flat_map(&Path.wildcard(&1, match_dot: true))
|> Kernel.--([
"test/fixtures/mocks/isobmff.exs"
])
],
line_length: 88
]
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ anaconda-mode/
/docs/all.json
/docs/
/.idea/

.DS_Store
/tmp/
53 changes: 39 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# CHANGELOG

## v1.0.0 (2025-03-27)

**Enhancements:**

- Full support for ISOBMFF image formats (box-type): HEIF, HEIC and AVIF.
- Reordering types being checked in guessing functions (`{seems?,type,info}/1`), focusing on recent trends.
- Docs and testing improvements.

**News:**

- First major release of ExImageInfo, after years working without issues and really stable.

**Statistics:**

- 79 TDD Tests:
- including 32 images being tested, also fetching external images on-the-fly.
- supporting partial streams and including many binary mocks/fixtures (up to 50 tests to verify edge cases).
- Code coverage of 98.3%.
- Supports 13 image formats and 23 variants.
- No dependencies.

**Acknowledgments:**

- @bu6n for the first attempts about heic/heif/avif support and starting as a reviewer.

## v0.2.7 (2025-03-05)

**Enhancements:**
Expand Down Expand Up @@ -47,9 +72,9 @@

**Enhancements:**

- By request of a GitHub user: support for another variant of webp
- Studied and integrated the webpVP8X format (bitstream animated)
- Added 2 new tests for animated photos: gif and webp vp8x
- By request of a GitHub user: support for another variant of webp.
- Studied and integrated the webpVP8X format (bitstream animated).
- Added 2 new tests for animated photos: gif and webp vp8x.

## v0.2.3 (2018-05-21)

Expand Down Expand Up @@ -94,14 +119,14 @@
**Enhancements:**

- The guessing function is ordered by global usage [usage of image file formats](https://w3techs.com/technologies/overview/image_format/all), but still keeping *png* as the first one.
- Added support for *ico*, *jp2* (*jpeg 2000*) and the collection of *pnm* (*pbm*, *pgm* and *ppm*)
- *ico* gets the dimensions of the largest image contained (not the first found)
- Added support for *ico*, *jp2* (*jpeg 2000*) and the collection of *pnm* (*pbm*, *pgm* and *ppm*).
- *ico* gets the dimensions of the largest image contained (not the first found).

**Statistics:**

- 54 TDD Tests
- Code coverage of 98.3%
- 10 image formats supported
- 54 TDD Tests.
- Code coverage of 98.3%.
- 10 image formats supported.

**News:**

Expand All @@ -111,20 +136,20 @@

**Enhancements:**

- Warnings corrected (compiling)
- Warnings corrected (compiling).

**Statistics:**

- 34 TDD Tests
- Code coverage of 97.6%
- 7 image formats supported
- 34 TDD Tests.
- Code coverage of 97.6%.
- 7 image formats supported.

**News:**

- Initial release (published) + Docs (gh-pages)
- Initial release (published) + Docs (gh-pages).

## v0.1.0 (2016-08-11)

**News:**

- Initial release (pre-publish)
- Initial release (pre-publish).
91 changes: 55 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ExImageInfo

[![Elixir](https://img.shields.io/badge/made_in-elixir-9900cc.svg?style=flat-square)](http://elixir-lang.org) [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/Group4Layers/ex_image_info/master/LICENSE.md) [![Coverage](https://img.shields.io/badge/coverage-98.4%25-green.svg)](https://github.com/Group4Layers/ex_image_info) [![Tests](https://img.shields.io/badge/tests-58%2F58-green.svg)](https://github.com/Group4Layers/ex_image_info)
[![v1.0.0](https://img.shields.io/badge/version-1.0.0-a1c43c.svg)](https://hex.pm/packages/ex_image_info) [![Elixir](https://img.shields.io/badge/made_in-elixir-9900cc.svg)](http://elixir-lang.org) [![Elixir ≥1.13](https://img.shields.io/badge/-≥1.13-9900cc.svg?logo=Elixir)](http://elixir-lang.org) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Group4Layers/ex_image_info/master/LICENSE.md) [![Coverage](https://img.shields.io/badge/coverage-98.4%25-green.svg)](https://github.com/Group4Layers/ex_image_info) [![Tests](https://img.shields.io/badge/tests-79%2F79-green.svg)](https://github.com/Group4Layers/ex_image_info)

ExImageInfo is an Elixir library to parse images (binaries) and get the dimensions (size), detected mime-type and overall validity for a set of image formats. It is the fastest and supports multiple formats.

Expand Down Expand Up @@ -48,15 +48,17 @@ supported by the library.
Supported formats (image type to be parsed as):
- `:bmp`
- `:gif`
- `:ico` (new in `v0.2.0`)
- `:jpeg`
- `:jpg` (alias of `jpeg` in `v0.2.3`)
- `:jp2` (new in `v0.2.0`)
- `:ico`
- `:jpeg` (`:jpg` alias since `v0.2.3`)
- `:jp2`
- `:png`
- `:pnm` (new in `v0.2.0`)
- `:pnm`
- `:psd`
- `:tiff`
- `:webp` (VP8X animated in `v0.2.4`)
- `:webp`
- `:avif`
- `:heic`
- `:heif`

## Mime-types and Variants

Expand All @@ -66,37 +68,54 @@ mime-type).

Each mime-type can be linked to at least one variant type:

| mime-type | variant type | description |
| ------------------------- | ------------ | ------------------ |
| `image/bmp` | `BMP` | |
| `image/gif` | `GIF87a` | 87a gif spec |
| `image/gif` | `GIF89a` | 89a gif spec |
| `image/x-icon` | `ICO` | |
| `image/jpeg` | `baseJPEG` | baseline JPEG |
| `image/jpeg` | `progJPEG` | progressive JPEG |
| `image/jp2` | `JP2` | JPEG2000 |
| `image/png` | `PNG` | |
| `image/x-portable-anymap` | `PNMpbm` | Portable BitMap |
| `image/x-portable-anymap` | `PNMpgm` | Portable GrayMap |
| `image/x-portable-anymap` | `PNMppm` | Portable PixMap |
| `image/psd` | `PSD` | |
| `image/tiff` | `TIFFII` | II variant |
| `image/tiff` | `TIFFMM` | MM variant |
| `image/webp` | `webpVP8` | lossy |
| `image/webp` | `webpVP8L` | lossless |
| `image/webp` | `webpVP8X` | animated |

The variant type is created just to provide a bit more of information
for every image format (if applicable).

*Note*: `:ico` returns the dimensions of the largest image contained (not the first found).

The guessing functions try to detect the format of the binary by testing every available type based on its global usage (popularity, [usage of image file formats](https://w3techs.com/technologies/overview/image_format/all), but still keeping the `:png` as the first one):
- `:png`, `:jpeg`, `:gif`, `:bmp`, `:ico`, `:tiff`, `:webp`, `:psd`, `:jp2`, `:pnm`
| mime-type | variant type | description | since version |
|---------------------------|--------------|--------------------|---------------|
| `image/avif` | `AVIF` | | v1.0.0 |
| `image/avif-sequence` | `AVIFS` | | v1.0.0 |
| `image/bmp` | `BMP` | | |
| `image/gif` | `GIF87a` | 87a gif spec | |
| `image/gif` | `GIF89a` | 89a gif spec | |
| `image/heic` | `HEIC` | | v1.0.0 |
| `image/heic-sequence` | `HEICS` | | v1.0.0 |
| `image/heif` | `HEIF` | | v1.0.0 |
| `image/heif-sequence` | `HEIFS` | | v1.0.0 |
| `image/x-icon` | `ICO` | | v0.2.0 |
| `image/jp2` | `JP2` | JPEG2000 | v0.2.0 |
| `image/jpeg` | `baseJPEG` | baseline JPEG | |
| `image/jpeg` | `progJPEG` | progressive JPEG | |
| `image/png` | `PNG` | | |
| `image/x-portable-anymap` | `PNMpbm` | Portable BitMap | v0.2.0 |
| `image/x-portable-anymap` | `PNMpgm` | Portable GrayMap | v0.2.0 |
| `image/x-portable-anymap` | `PNMppm` | Portable PixMap | v0.2.0 |
| `image/psd` | `PSD` | | |
| `image/tiff` | `TIFFII` | II variant | |
| `image/tiff` | `TIFFMM` | MM variant | |
| `image/webp` | `webpVP8` | lossy | |
| `image/webp` | `webpVP8L` | lossless | |
| `image/webp` | `webpVP8X` | animated | v0.2.4 |

The variant type is created just to provide a bit more of information for every image format (if applicable).
If version is empty, it means that it was supported since the initial release.

Formats (maybe) containing multiple images:
- `:ico` returns the dimensions of the largest image found.
- `:heif`, `:heic` and `:avif` return the dimensions of the main image being selected (`primary_box`).

The guessing functions try to detect the format of the binary by testing every available type based on its
global usage and current trends (popularity, [usage of image file formats](https://w3techs.com/technologies/overview/image_format/all)):
- `jpeg`, `png`, `webp`, `avif`, `gif`, `heic`, `heif`, `bmp`, `ico`, `tiff`, `psd`, `jp2`, `pnm`

**Warnings:**

- Use with caution the formats *ico*, *jp2* and the family *pnm*. They are implemented without following other libraries (just reading the specs - sometimes working with old drafts like *jp2*). You can support this library by providing more tests and image *fixtures* or requesting other variants to be tested.
- Use with caution the formats *ico*, *jp2* and the family *pnm*. They are implemented without following
other libraries (just reading the specs - sometimes working with old drafts like *jp2*).
- ISOBMFF format (*heif*, *heic* and *avif*) is the most complex format being supported, with most parts
being implemented following the specs and testing against binary streams manually produced.
Please, use with caution and report any issue found.

**Contributions:** you can support this library by providing more tests, image *fixtures* (like `image/heic-sequence`),
increasing code coverage or extending support for other variants.


## Installation

Expand All @@ -108,7 +127,7 @@ From Hex:
def deps do
[
# ...
{:ex_image_info, "~> 0.2.4"},
{:ex_image_info, "~> 1.0.0"},
]
end
```
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.7
1.0.0
Loading