tags:

views:

449

answers:

2

Hi,

I am developing a WPF application. In which I am trying to save images. After saving the image, the color balance of the image turns to light reddish. How can we retain the original color of image after saving also. Is there any solution for that.

A: 

I suspect you are saving images with transparency into a BITMAP format. Bitmaps do not support transparency as such, but usually use a colour replacement technology to give the illusion of transparency. The default colour for this is magenta I believe.

You might try saving the images either as PNG's, or perhaps there is a way to specify the transparency colour (I'm not sure).

samjudson
We have tried in png but still we are getting the reddish layer over the images which is clearly visible after it is printed.If u can help me i will send u the both images(original and saved one).
A reddish layer? That sounds very weird. See profile for web site link (and hence email) if you think I could help, but my WPF is very limited.
samjudson
I didnt got ur mail id. can u plz send me ur mail id so that i can send u the related code. Plz help me regarding this
A: 

It sounds like this could be because your source image is in CMYK colour mode and your output is in RGB colour mode.

Could you please provide us with some more information about the source image and output image? (colour mode, image format, etc...)

Also, what sort of image processing are you doing? (resizing, saving a bitmap as a jpeg, etc...)

DoctaJonez
Thanks for ur reply.I tried both PNG and JPEGEncoder for saving the images. Iam using the following code RenderTargetBitmap renderBitmap = null; renderBitmap = new RenderTargetBitmap( (int)(width * (dpiFactor)), (int)(height * (dpiFactor)), 300d, 300d, PixelFormats.Pbgra32); renderBitmap.Render(surface);whats the wrong in that i dont know..
RenderTargetBitmap renderBitmap = null; renderBitmap = new RenderTargetBitmap( (int)(width * (dpiFactor)), (int)(height * (dpiFactor)), 300d, 300d, PixelFormats.Pbgra32); renderBitmap.Render(surface); using (FileStream outStream = new FileStream(path.LocalPath, FileMode.Create)){ PngBitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(renderBitmap)); encoder.Save(outStream); }
Source image is any image(.jpeg,.png,gif,....) and Outout image is PNG.The Code we are using is
RenderTargetBitmap renderBitmap = null; renderBitmap = new RenderTargetBitmap( (int)(width * (dpiFactor)), (int)(height * (dpiFactor)), 300d, 300d, PixelFormats.Pbgra32); renderBitmap.Render(surface); using (FileStream outStream = new FileStream(path.LocalPath, FileMode.Create)){ PngBitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(renderBitmap)); encoder.Save(outStream); }