-
Notifications
You must be signed in to change notification settings - Fork 546
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
[BUG] Color of jpeg image changed after decode/encode #931
Comments
I can confirm that using above image - using both bitmap and image - and the SkImage will make it entirely black on downscaling (#932). |
What happens if you try |
in this project I cannot access but that, color space = null, codec + image only etc. it seems to lose some color data still (I'm am doing blind try'n'error here) - but I think I saw that the v2.80 made it "50%" better / closer to org. color - so most likely a Skia core thing. |
okay - so this might be fixed now - the only "cause" of the difference now is that Chrome shows the original image in a brighter color - but it's the only app that does so!.. windows explorer, adobe photoshop, paint .net, edge - all shows with the produced color.. so in my opinion v2.80 closes this one too! 🍺🕺 |
Oooh, this reminds me of something... #1238 Might be that skia is using a codec that only Chrome understands. Try it in GIMP and see what happens. See also: https://groups.google.com/forum/#!topic/skia-discuss/b8JtsaOw7_o |
too me it seems like (not being concrete here) old image bad in chrome, new image (skia produced) a new kind of bad in all viewers.. new skia alpha version, old image bad in chrome, new image good in all viewers.. anyway - I'm happy with the new alpha :) so closed imho |
We encountered this problem with another JPEG image. Adding the image here. |
FYI: The GIMP shows the images the same as Chrome... When dumping the metadata with ExifTool, the
I will try re-encoding using the official LibJpeg tools, and see... |
@AndersMad Where can I get this (2.84.0-preview.2) build to test on my side? by the way the image you have attached still looks incorrect to me. Here is comparison. The top image is the original and the bottom is after resaving with SkiaSharp. |
@AlexNosk I did save it as WebP - maybe theres a diff. there.. Try opening the image out formats in different browsers and editors to see - including the source image. To get the beta version add this to your NuGet package source list: https://nugetized.blob.core.windows.net/skiasharp-eap/index.json |
@AndersMad I have checked with the latest beta and IMHO the problem is still there. I have compared the input and output image in different browsers: In viewers and editors Also checked on mobile devices - The problem is that in our software SkiaSharp is used to process graphics when convert MS Word documents to different formats and our customers expect that colors they see in MS Word remain unchanged. |
@AlexNosk but its better right ;) try send the out.jpg you generated with the beta and I will try it out in the latest Adobe Photoshop |
@AndersMad Here are input and output produced by the latest beta |
I think this is related to #523 It was resolved by setting the colorspace explicitly. Maybe that helps in your case too? Now, your JPEG files are 4 component CMYK or YCCK, see e.g. https://stackoverflow.com/questions/50798014/determining-color-space-for-jpeg Not a lot of image software will handle these correctly I'm afraid... |
Also, since no JPEG decoders support the CMYK to RGB conversion, Skia tries to do this manually. The source code contains some interesting comments:
|
@ziriax Thank you for your suggestion. I tried setting colorspace explicitly, but, unfortunately, this does not help. |
I'm interested to find out what is going on. I will debug this. Hopefully I can find the reason. |
@AlexNosk confirmed that Adobe Photoshop (latest version) shows a color difference too.. So only Google Chromium display the Google Skia output correctly. |
I have the same problem. I Atatch the image |
@mattleibow @AndersMad @ziriax I encountered a similar issue with another Jpeg image. Attached the files for testing. |
@mattleibow @AndersMad @ziriax , I to have this problem with different images. Attaching them to for testing |
Description
After decoding and encoding image it's color is changed (blue color becomes brighter). The latest (1.68) version is used, tested on Windows.
Code
using (FileStream inputStream = File.Open(@"C:\Temp\in.jpeg", FileMode.Open))
using (SkiaSharp.SKBitmap bmp = SkiaSharp.SKBitmap.Decode(inputStream))
using (SkiaSharp.SKFileWStream outputStream = new SkiaSharp.SKFileWStream(@"C:\Temp\out.jpeg"))
{
SkiaSharp.SKPixmap.Encode(outputStream, bmp, SkiaSharp.SKEncodedImageFormat.Jpeg, 100);
}
Expected Behavior
The result image must look the same as input. Attached input and output images.
The text was updated successfully, but these errors were encountered: