Click here to Skip to main content
15,884,086 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
thanks
Posted
Comments
Pro Idiot 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

Try
C#
using(Image img = Image.FromFile("foo.bmp"))
   {
       img.Save("foo.jpg", ImageFormat.Jpeg);
   }

or
C#
byte[] raw = ...todo // File.ReadAllBytes("foo.bmp");
    using(Image img = Image.FromStream(new MemoryStream(raw)))
    {
        img.Save("foo.jpg", ImageFormat.Jpeg);
    }
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900