0

Im creating a new Bitmap object as below,

var image = new Bitmap(@"C:\file.jpg"); 

I will be doing several modifications in pixel levels in the spatial domain and if save this object again as below.

 image.Save(@"D:\final.jpg", ImageFormat.bitmap); 
  1. Is this final image is a really a jpg or a bitmap ? ,

Using this functional is there a way we can save a jpg lossless ?

2
  • What do you mean buy this - "save a jpg looseness"? Commented Sep 22, 2014 at 9:18
  • Maybe, it means lossless. Commented Sep 22, 2014 at 9:20

2 Answers 2

6
image.Save(@"D:\final.jpg", ImageFormat.Bmp); 

will save a bitmap image in spite of the extension

Jpg is a lossy compression method, if you want loseless you can use either Bmp or Png

Sign up to request clarification or add additional context in comments.

Comments

0

The Bitmap class is always in a 'raw' format. So what happens in your code is:

  1. Read from a JPEG file (lossy format) into a Bitmap class (raw lossless format).
  2. Save the contents of the Bitmap class into another file (BMP lossless format).

The contents of the Bitmap class after that is still in raw lossless format so that you can continue to manipulate it, or save it to file in yet another format (lossless or lossy).

Note: The 'raw' format I mentioned above is not the same format as some .raw files that you sometimes encounter in music editing programs. By 'raw' format I just mean some temporary arbitrary format that Bitmap uses to store the image data in itself (possibly in byte[]).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.