elixir-image / image

Image processing for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image.dhash/2 returning the same hash value `<<255,255,255,255>>` for all images

kipcole9 opened this issue · comments

iex(1)> i1 = Image.open! "/Users/kip/Desktop/image_1.png"
%Vix.Vips.Image{ref: #Reference<0.3587648705.3975544857.16961>}
iex(2)> i2 = Image.open! "/Users/kip/Desktop/image_2.png"
%Vix.Vips.Image{ref: #Reference<0.3587648705.3975544857.16963>}
iex(3)> Image.dhash i1
{:ok, <<255, 255, 255, 255, 255, 255, 255, 255>>}
iex(4)> Image.dhash i2
{:ok, <<255, 255, 255, 255, 255, 255, 255, 255>>}
iex(5)> {:ok, h1} = Image.dhash i1
{:ok, <<255, 255, 255, 255, 255, 255, 255, 255>>}
iex(6)> {:ok, h2} = Image.dhash i2
{:ok, <<255, 255, 255, 255, 255, 255, 255, 255>>}
iex(7)> i3 = Image.open! "/Users/kip/Desktop/image_3.png"
%Vix.Vips.Image{ref: #Reference<0.3587648705.3975544862.15094>}
iex(8)> {:ok, h3} = Image.dhash i3
{:ok, <<255, 255, 255, 255, 255, 255, 255, 255>>}
iex(9)> k = Image.open! "./test/support/images/Kamchatka-2019-8754.jpg"
%Vix.Vips.Image{ref: #Reference<0.3587648705.3975544857.16969>}
iex(10)> Image.dhash k
{:ok, <<255, 255, 255, 255, 255, 255, 255, 255>>}
iex(11)> k = Image.open! "./test/support/images/Hong-Kong-2015-07-1998.jpg"
%Vix.Vips.Image{ref: #Reference<0.3587648705.3975544862.15116>}
iex(12)> Image.dhash k
{:ok, <<255, 255, 247, 255, 255, 255, 255, 255>>}

I've published Image version 0.38.4 with the following changelog entry:

Bug Fixes

  • Fixes Image.dhash/2. Thanks to @jhonathas for the report. Closes #118.

  • Fixes compiler warnings for Elixir 1.16.