Skip to content

Commit

Permalink
Add workaround for PNG files
Browse files Browse the repository at this point in the history
  • Loading branch information
opennota committed Mar 8, 2015
1 parent 17b0e04 commit 7a6e87c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pHash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ ph_dct_imagehash_wrapper(const char *file) {
return hash;
}

// Magic; without it pHash fails to compute hashes for some PNG files (compiler or linker issue?)
void
magic() {
cimg::exception_mode(3);
CImg<uint8_t> src;
src.load(NULL);
}

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions phash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var dctTestData = []struct {
{"testdata/jpg/gopher-flop.jpg", 17752165113623953620},
{"testdata/jpg/gopher-shave.jpg", 11459704921468884741},
{"testdata/png/gopher.png", 10631249863007147461},
{"testdata/png/navalny.png", 7471994969771757134},
}

var hammingTestData = []struct {
Expand Down
Binary file added testdata/png/navalny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7a6e87c

Please sign in to comment.