Click here to Skip to main content
11,632,778 members (84,760 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Visual-Studio
My program can use SetPixelColor function but after saving bitmap to jpg file my colors convert to wrong colors
Please help me for saving image to jpg file with small size and with my right colors
or help me to restore default colors
Posted 28-Sep-12 3:40am
Deepak Jena at 28-Sep-12 13:43pm
You have a bitmap byte array or a bmp image ?

And mention the code, you used to convert , then only any 1 can find out what the issue is

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

 using(Image img = Image.FromFile("foo.bmp"))
        img.Save("foo.jpg", ImageFormat.Jpeg);
byte[] raw = ...todo // File.ReadAllBytes("foo.bmp");
    using(Image img = Image.FromStream(new MemoryStream(raw)))
        img.Save("foo.jpg", ImageFormat.Jpeg);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,498
1 Sergey Alexandrovich Kryukov 8,149
2 Mika Wendelius 6,260
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 1,995

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100