Skip to content

False 1.0 similarity for PNG on Mac OS El Captain #11

@Nakilon

Description

@Nakilon

I was using pHash via Ruby gem phash on a bit outdated Mac OS. After installing El Captain on new HDD (and so reinstalling pHash) it started to give false positive (1.0) similarity when at least one image is PNG. For example:

Values for JPEG didn't start to be wrong so when I convert the above images to JPEG, it says 0.46875
I forced an old version of gem ffi, but it had no effect -- probably smth changed in these binaries:

==> Installing dependencies for homebrew/boneyard/phash: cimg, x264, lame, xvid, ffmpeg, flac, libogg, l
==> Installing homebrew/boneyard/phash dependency: cimg
==> Downloading https://homebrew.bintray.com/bottles/cimg-1.6.9.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring cimg-1.6.9.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/cimg/1.6.9: 72 files, 14.3M
==> Installing homebrew/boneyard/phash dependency: x264
==> Downloading https://homebrew.bintray.com/bottles/x264-r2668.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring x264-r2668.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/x264/r2668: 10 files, 3.3M
==> Installing homebrew/boneyard/phash dependency: lame
==> Downloading https://homebrew.bintray.com/bottles/lame-3.99.5.el_capitan.bottle.1.tar.gz
######################################################################## 100,0%
==> Pouring lame-3.99.5.el_capitan.bottle.1.tar.gz
🍺  /usr/local/Cellar/lame/3.99.5: 26 files, 2M
==> Installing homebrew/boneyard/phash dependency: xvid
==> Downloading https://homebrew.bintray.com/bottles/xvid-1.3.4.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring xvid-1.3.4.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/xvid/1.3.4: 9 files, 1.3M
==> Installing homebrew/boneyard/phash dependency: ffmpeg
==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.1.1_1.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring ffmpeg-3.1.1_1.el_capitan.bottle.tar.gz
==> Caveats
The native FFmpeg AAC encoder has been stable since FFmpeg 3.0. If you
were using libvo-aacenc or libaacplus, both of which have been dropped in
FFmpeg 3.0, please consider switching to the native encoder (-c:a aac),
fdk-aac (-c:a libfdk_aac, ffmpeg needs to be installed with the
--with-fdk-aac option), or faac (-c:a libfaac, ffmpeg needs to be
installed with the --with-faac option).

See the announcement
https://ffmpeg.org/index.html#removing_external_aac_encoders for details,
and https://trac.ffmpeg.org/wiki/Encode/AAC on best practices of encoding
AAC with FFmpeg.
==> Summary
🍺  /usr/local/Cellar/ffmpeg/3.1.1_1: 236 files, 50.1M
==> Installing homebrew/boneyard/phash dependency: flac
==> Downloading https://homebrew.bintray.com/bottles/flac-1.3.1.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring flac-1.3.1.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/flac/1.3.1: 52 files, 2.2M
==> Installing homebrew/boneyard/phash dependency: libogg
==> Downloading https://homebrew.bintray.com/bottles/libogg-1.3.2.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring libogg-1.3.2.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libogg/1.3.2: 96 files, 457.3K
==> Installing homebrew/boneyard/phash dependency: libvorbis
==> Downloading https://homebrew.bintray.com/bottles/libvorbis-1.3.5.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring libvorbis-1.3.5.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libvorbis/1.3.5: 158 files, 2.3M
==> Installing homebrew/boneyard/phash dependency: libsndfile
==> Downloading https://homebrew.bintray.com/bottles/libsndfile-1.0.26.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring libsndfile-1.0.26.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libsndfile/1.0.26: 48 files, 1.8M
==> Installing homebrew/boneyard/phash dependency: libsamplerate
==> Downloading https://homebrew.bintray.com/bottles/libsamplerate-0.1.8.el_capitan.bottle.2.tar.gz
######################################################################## 100,0%
==> Pouring libsamplerate-0.1.8.el_capitan.bottle.2.tar.gz
==> Caveats
Unless this formula is built with libsndfile, the example program,
"sndfile-resample", is broken and hence, removed from installation.
==> Summary
🍺  /usr/local/Cellar/libsamplerate/0.1.8: 26 files, 3.0M
==> Installing homebrew/boneyard/phash dependency: mpg123
==> Downloading https://homebrew.bintray.com/bottles/mpg123-1.23.6.el_capitan.bottle.tar.gz
######################################################################## 100,0%
==> Pouring mpg123-1.23.6.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/mpg123/1.23.6: 22 files, 687.9K

See some background about installation: toy/pHash#8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions