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

I can't get dominant colors from pictures taken with iPhone #16

Open
papueh opened this issue May 16, 2021 · 3 comments
Open

I can't get dominant colors from pictures taken with iPhone #16

papueh opened this issue May 16, 2021 · 3 comments

Comments

@papueh
Copy link

papueh commented May 16, 2021

Hello,

first of all I wanted to say thank you for this awesome kit.

I'm using ColorKit to generate a color palette of pictures that I manually add from my photo library. Everything work good but I only have problems with pictures of my library that were not taken with my iPhone.

If I want to get the colors of pictures taken with my iPhone or a screenshot which was taken with my iPhone the function .dominantColors does not work.

Is it a format thing? or maybe I missed something.

If I send the picture per WhatsApp and then I download the same picture I can get the colors but not from the original. Photos taken with an external camera and then imported to the iPhone have also no problem at all. Only Iphone photos.

I appreciate your help, thank you very much!

Pablo.

UPDATE
I think that the problem is that ColorKit can't use .dominantColors() with pictures taken with the iPhone because they are HEIF/HEIC files. I still can't solve the problem but I'm trying to convert the image to JPEG. I don't know if that is useful because I thought UIImage also supports HEIF format.

@vipulRajput
Copy link

Hi dude, u figured it out anything??

@Leon-Kang
Copy link

Because the cgImages' data is different, but file DominantColors.swift line 159 condition does not separate the image types. And filtered all data that were lower than 150. Changing the number 150 to a lower number will work for HEIF(like the 50 I used).

@Leon-Kang
Copy link

The lib resized the image, so if you can get colors, try image.dominantColorFrequencies(with: UIImage.DominantColorQuality.best), will not resize the image just using the original image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants