Skip to content

Commit

Permalink
Adapt header format to new specification
Browse files Browse the repository at this point in the history
See phoboslab/qoi#37

Signed-off-by: Riccardo Binetti <[email protected]>
  • Loading branch information
rbino committed Nov 28, 2021
1 parent dad87bf commit b8d8174
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/qoix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ defmodule Qoix do
Qoix is an Elixir implementation of the [Quite OK Image](https://phoboslab.org/log/2021/11/qoi-fast-lossless-image-compression) format.
"""

@header_size 12

@doc """
Returns true if the binary appears to contain a valid QOI image.
"""
def qoi?(<<"qoif", _width::size(16), _height::size(16), size::size(32), _::binary>> = binary)
when byte_size(binary) >= @header_size + size do
def qoi?(<<"qoif", _width::32, _height::32, channels::8, _colorspace::8, _rest::binary>>)
when channels == 3 or channels == 4 do
true
end

Expand Down

0 comments on commit b8d8174

Please sign in to comment.