Open bgaillard opened 8 years ago
I witnessed a similar problem between GD and Imagick on the same environment. Sadly I have no idea if it's related or what is causing this.
@MatTheCat Thanks for those additional informations, I also encounter diffrencies with the https://github.com/jenssegers/imagehash library.
I'm not 100% sure but in my opinion JPEG files (and perhaps other kind of files) are not treated the same way depending on the OS / PHP / GD versions in use.
For example this Stackoverflow post http://stackoverflow.com/questions/10647266/image-file-size-differences-between-imagemagick-and-gd-library indicates.
It turns out that JPEG quality scales are not defined in a specification or standard, and they are not uniform across encoders. A quality of 60 in Photoshop might be the same as a quality of 40 in one program, quality B+ in another and quality fantastico in a third. In my tests, I found that Photoshop’s 60 is closest to -quality 82 in ImageMagick.
Perhaps this issue is also similar https://github.com/Intervention/image/issues/355.
Does anyone know if this supposition is correct or have much more informations about those differencies ?
I don't think the problem comes from compression as I saw a difference between GD and Imagick with the exact same image.
Handled the similar problem that Imagemagic and gd calculates different number of unique colors imagemagic(279123) vs gd(279069) on the exact same image (difference on a lot of tested images is approximately 100)
@MelnikDima how did you handle it?
@MatTheCat something like $image->getImageColors(); // unique colors by Image magic
$palette = Palette::fromFilename($file); $palette_count = count($palette); // unique_colors by gd
Maybe the best course would be to just ignore these differences :thinking:
Hi, I just started to use
color-extractor
in one or our customer's project.We wrote a unit test to check our code and it appears the
Palette.getMostUsedColors()
function is not returning de same results depending on the OS and/or PHP version in use (perhaps this could also be dependent on the GD version which is installed on the machine).For exemple on a Unix machine we get this array (the
limit
parameter is equal to12
and the index of this array has been converted to hexadecimal).On a Windows machine and with the same image we get the following values.
We only encounter this problem with one testing JPEG file (I can provide you the file if needed).
We also have similar unit test with GIF and PNG files, with those formats we do not encounter any problem.
So do you know what could cause differences in our case ?
If it can help here are much more details about each testing envirronment
If the problem is linked to GD perhaps doing the same test with https://github.com/thephpleague/color-extractor/issues/37 could be interesting.
In any case I the problem cannot be solved IMO it should be described and explained in the README.
Thanks