Click here to Skip to main content
Rate this: bad
good
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
thanks
Posted 28-Sep-12 3:40am
Comments
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
good
Please Sign up or sign in to vote.

Solution 1

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

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



Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2014
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