-
Notifications
You must be signed in to change notification settings - Fork 242
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
Wrong thumbnail colors #97
Comments
@liptonshmidt Immediately after loading the image with ImageIO, what kind of Type is the image that ImageIO returns and what type is the image that the first call to imgscalr returns? Given how the result looks I am almost certain this is a channel-loss issue, but I am wondering why the PNG conversion is having issues (typically this happens when people convert something with an ALPHA channel to JPG and it clips out the BLUE channel or something like that). |
Hrmm, I think the issue here is the conversion imgscalr is doing from the ComponentColorModel to the DirectColorModel when it converts the image to a more supported type (RGB). Does this workaround work if you manually convert the initially loaded BufferedImage using this code: and then pass the result to imgscalr and save it out? I really hope not because setting the pixel data on the buffer pixel-by-pixel is much slower, but at least it would help us understand where things are going south if you didn't mind trying it. |
If I understand, firstly I should convert uploaded BufferedImage to swt ImageData object as was demonstrated on stackoverflow, and then, to pass it to scalr, i should convert swt ImageData object back again to BufferedImage object? |
Damn, I'm sorry -- I didn't realize that the answer was utilizing SWT classes - no, I wasn't suggesting that you needed to lean on the SWT classes to get this done. I don't happen to know the right conversion here for the ComponentColorModel to make this picture look right however. The problem sounds familiar to me (I think I looked at this a few years ago) but I don't know the answer off hand using straight Java/Java2D. If I run into the solution I will post it here however. |
Any news? |
Sorry for the necro, has there been a resolution to this issue? |
@lordmarkm we had the same issue as described here, code would work fine for days then start returning the wrong colours. Identical source images. We eventually swapped out imgscalr for TwelveMonkeys ImageIO scaling code. |
@Firefishy My problem turned out to be a java issue. |
related: #119 |
The image below transforms into wrong-colored thumbnail.
My first guess was about alpha-channel, but i haven't found it in this image.
My thumbnail is equal to one that http://imgscalr.com/ produces.
(red color prevails)
(I also tried to rename it into jpg but the story was the same)
The text was updated successfully, but these errors were encountered: