Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed alpha channel issue #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed alpha channel issue
  • Loading branch information
Reubot-J committed Jan 30, 2023
commit 8ade1e1efa313676c6a0c03da2ac3a943af3faab
8 changes: 7 additions & 1 deletion src/pHash.cpp
Original file line number Diff line number Diff line change
@@ -218,7 +218,13 @@ int _ph_image_digest(const CImg<uint8_t> &img, double sigma, double gamma,
Digest &digest, int N) {
int result = EXIT_FAILURE;
CImg<uint8_t> graysc;
if (img.spectrum() >= 3) {

if(img.spectrum() >3)
{
CImg<> rgb = img.get_shared_channels(0,2);
graysc = rgb.RGBtoYCbCr().channel(0);
}
else if (img.spectrum() == 3) {
graysc = img.get_RGBtoYCbCr().channel(0);
} else if (img.spectrum() == 1) {
graysc = img;