You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+39-14Lines changed: 39 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,30 @@
1
1
# CHANGELOG
2
2
3
+
## v1.0.0 (2025-03-27)
4
+
5
+
**Enhancements:**
6
+
7
+
- Full support for ISOBMFF image formats (box-type): HEIF, HEIC and AVIF.
8
+
- Reordering types being checked in guessing functions (`{seems?,type,info}/1`), focusing on recent trends.
9
+
- Docs and testing improvements.
10
+
11
+
**News:**
12
+
13
+
- First major release of ExImageInfo, after years working without issues and really stable.
14
+
15
+
**Statistics:**
16
+
17
+
- 79 TDD Tests:
18
+
- including 32 images being tested, also fetching external images on-the-fly.
19
+
- supporting partial streams and including many binary mocks/fixtures (up to 50 tests to verify edge cases).
20
+
- Code coverage of 98.3%.
21
+
- Supports 13 image formats and 23 variants.
22
+
- No dependencies.
23
+
24
+
**Acknowledgments:**
25
+
26
+
-@bu6n for the first attempts about heic/heif/avif support and starting as a reviewer.
27
+
3
28
## v0.2.7 (2025-03-05)
4
29
5
30
**Enhancements:**
@@ -47,9 +72,9 @@
47
72
48
73
**Enhancements:**
49
74
50
-
- By request of a GitHub user: support for another variant of webp
51
-
- Studied and integrated the webpVP8X format (bitstream animated)
52
-
- Added 2 new tests for animated photos: gif and webp vp8x
75
+
- By request of a GitHub user: support for another variant of webp.
76
+
- Studied and integrated the webpVP8X format (bitstream animated).
77
+
- Added 2 new tests for animated photos: gif and webp vp8x.
53
78
54
79
## v0.2.3 (2018-05-21)
55
80
@@ -94,14 +119,14 @@
94
119
**Enhancements:**
95
120
96
121
- 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.
97
-
- Added support for *ico*, *jp2* (*jpeg 2000*) and the collection of *pnm* (*pbm*, *pgm* and *ppm*)
98
-
-*ico* gets the dimensions of the largest image contained (not the first found)
122
+
- Added support for *ico*, *jp2* (*jpeg 2000*) and the collection of *pnm* (*pbm*, *pgm* and *ppm*).
123
+
-*ico* gets the dimensions of the largest image contained (not the first found).
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.
8
8
@@ -48,18 +48,17 @@ supported by the library.
48
48
Supported formats (image type to be parsed as):
49
49
-`:bmp`
50
50
-`:gif`
51
-
-`:ico` (since `v0.2.0`)
52
-
-`:jpeg`
53
-
-`:jpg` (alias of `jpeg` since `v0.2.3`)
54
-
-`:jp2` (since `v0.2.0`)
51
+
-`:ico`
52
+
-`:jpeg` (`:jpg` alias since `v0.2.3`)
53
+
-`:jp2`
55
54
-`:png`
56
-
-`:pnm` (since `v0.2.0`)
55
+
-`:pnm`
57
56
-`:psd`
58
57
-`:tiff`
59
-
-`:webp` (VP8X animated since `v0.2.4`)
60
-
-`:avif` (since `v1.0.0`)
61
-
-`:heic` (since `v1.0.0`)
62
-
-`:heif` (since `v1.0.0`)
58
+
-`:webp`
59
+
-`:avif`
60
+
-`:heic`
61
+
-`:heif`
63
62
64
63
## Mime-types and Variants
65
64
@@ -69,43 +68,54 @@ mime-type).
69
68
70
69
Each mime-type can be linked to at least one variant type:
The variant type is created just to provide a bit more of information
99
-
for every image format (if applicable).
100
-
101
-
*Note*: `:avif`, `:heic`, `:heif` and `:ico` return the dimensions of the primary (if available in that format) or the largest image contained (not the first found).
102
-
103
-
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)):
71
+
| mime-type | variant type | description | since version |
- 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.
110
+
- Use with caution the formats *ico*, *jp2* and the family *pnm*. They are implemented without following
111
+
other libraries (just reading the specs - sometimes working with old drafts like *jp2*).
112
+
- ISOBMFF format (*heif*, *heic* and *avif*) is the most complex format being supported, with most parts
113
+
being implemented following the specs and testing against binary streams manually produced.
114
+
Please, use with caution and report any issue found.
115
+
116
+
**Contributions:** you can support this library by providing more tests, image *fixtures* (like `image/heic-sequence`),
117
+
increasing code coverage or extending support for other variants.
Copy file name to clipboardExpand all lines: lib/ex_image_info.ex
+67-45Lines changed: 67 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
1
defmoduleExImageInfodo
2
2
@moduledoc"""
3
-
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. Main module to parse a binary and get if it seems to be an image (validity), the mime-type (and variant detected) and the dimensions of the image, based on a specific image format.
3
+
ExImageInfo is an Elixir library to parse images (binaries) and get the dimensions (size),
4
+
detected mime-type and overall validity for a set of image formats. Main module to parse a
5
+
binary and get if it seems to be an image (validity), the mime-type (and variant detected)
6
+
and the dimensions of the image, based on a specific image format.
4
7
5
8
It has convention functions to guess the type of an image
6
9
by trying the formats supported by the library.
@@ -21,15 +24,17 @@ defmodule ExImageInfo do
21
24
Supported formats (image type to be parsed as):
22
25
- `:bmp`
23
26
- `:gif`
24
-
- `:ico` (new in `v0.2.0`)
25
-
- `:jpeg`
26
-
- `:jpg` (alias of `jpeg` in `v0.2.3`)
27
-
- `:jp2` (new in `v0.2.0`)
27
+
- `:ico`
28
+
- `:jpeg` (`:jpg` alias since `v0.2.3`)
29
+
- `:jp2`
28
30
- `:png`
29
-
- `:pnm` (new in `v0.2.0`)
31
+
- `:pnm`
30
32
- `:psd`
31
33
- `:tiff`
32
-
- `:webp` (VP8X animated in `v0.2.4`)
34
+
- `:webp`
35
+
- `:avif`
36
+
- `:heic`
37
+
- `:heif`
33
38
34
39
## Mime-types and Variants
35
40
@@ -39,39 +44,53 @@ defmodule ExImageInfo do
39
44
40
45
Each mime-type can be linked to at least one variant type:
The variant type is created just to provide a bit more of information
69
-
for every image format (if applicable).
70
-
71
-
*Note*: `:ico` returns the dimensions of the largest image contained (not the first found).
72
-
73
-
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):
`ExImageInfo.seems?/2` and `ExImageInfo.seems?/1` does not necessarily needs a real image (as it is shown in the previous example) because it just checks the signature of every file format.
163
+
`ExImageInfo.seems?/2` and `ExImageInfo.seems?/1` does not necessarily needs a real image
164
+
(as it is shown in the previous example) because it just checks the signature of every file format.
145
165
146
166
Usually it is used as:
147
167
@@ -183,7 +203,8 @@ defmodule ExImageInfo do
183
203
iex> ExImageInfo.seems? <<0x384250::size(24)>>
184
204
nil
185
205
186
-
`ExImageInfo.seems?/2` and `ExImageInfo.seems?/1` does not necessarily needs a real image (as it is shown in the previous example) because it just checks the signature of every file format.
206
+
`ExImageInfo.seems?/2` and `ExImageInfo.seems?/1` does not necessarily needs a real image
207
+
(as it is shown in the previous example) because it just checks the signature of every file format.
187
208
188
209
Usually it is used as:
189
210
@@ -298,7 +319,7 @@ defmodule ExImageInfo do
298
319
299
320
If a binary is malformed, it returns `nil`, even if other calls like `type` or `seems?` return valid types.
0 commit comments