jpeg code

    Date: 10/04/05 (Computer Geeks)    Keywords: no keywords

    I'm trying to find some c# jpeg manipulation code.

    Specifically, I have a bitmap that I draw and then encode into a jpeg in a memory stream. As such, I have a byte array representing the jpeg.

    What I need to do is then set specific pixels to specific values.

    I need to do this because when setting them before encoding, the codec changes the pixel values during compression. This is expected and is no issue, but once that's all done, I'd like to set a few pixels to specific values before emitting the byte array through the response stream.

    Code, as such:

    bmPhoto is a bitmap, saved to imgStream.

    
      System.IO.Stream imgStream = new System.IO.MemoryStream();
    
      bmPhoto.Save(imgStream, ici, ep);
    
      imgStream.Seek(0, SeekOrigin.Begin);
    
      byte[] bA = new byte[imgStream.Length];
    
      imgStream.Read(bA, 0, (int)imgStream.Length);
    
      // MANIPULATE! I have bA[] as the array of bytes. 
      // I need code here to set, for example, the pixel
      // at 2,2 to a value of (40,50,60) 
      // (color as (R,G,B), of course.
    
      Response.OutputStream.Write(bA, 0, (int)imgStream.Length);


    Anyone?

    Source: http://www.livejournal.com/community/computergeeks/788408.html

« Drawing Pen/Pad to computer? || os x and scheme »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home