Hey there!
Here is my setup:
I have a C # application that extracts functions from a series of images. Due to the size of the data set (several thousand images), it is highly parallelized, so we have a high-performance machine with ssd that runs on Windows7 x64 (.NET4 runtime) to take off the hard work. I am developing it on a computer running Windows XP SP3 x86 in Visual Studio 2008 (.NET3.5) using Windows Forms - there is no way to move to WPF, by the way.
Edit3: It's weird, but I think I finally found out what was going on. It seems to be a codec for an image format that gives different results on two machines! I do not know exactly what is happening there, but the decoder on the xp machine gives more efficient results than win7. Unfortunately, the best version is still in the x86 XP system :( I think the only solution for this is to change the input image format to something without any loss, for example png or bmp (it's silly for me not to think about the file format in the first place :) )
Edit2: Thanks for your efforts. I think that I will stick to my own converter, this is not quite what I wanted, but I have to somehow solve it :). If someone is reading this, who has ideas for me, please let me know.
Edit: In the comments, I was recommended to use a third-party lib for this. I think I haven’t made myself clear enough, because I don’t want to use the DrawImage approach at all - it’s just a drawback of quickhack to get the actually working new Bitmap(tmp, ... myPixelFormat)
, which we hope will use some interpolation . What I want to achieve is solely to convert the incoming image to a common PixelFormat with some standard interpolation.
My problem is as follows. Some source images are in JPG format in Indexed8bpp format, which do not mix well with WinForms visualization materials. Therefore, in my image loading logic, there is a check for indexed images that convert the image to the default format for my applications (e.g. Format16bpp):
Image GetImageByPath(string path) { Image result = null; using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { Image tmp = Image.FromStream(fs);
I traced the problem to (*)
. I think InterpolationMode has something to do with it, but there is no difference which one I choose, different results in (**)
on both systems. I studied the test image data with some dumb lines to copy and paste to make sure that this is not a problem with accessing the data in the wrong way.
The images collectively look as follows Electron scattering diffraction pattern . Actual color values vary subtly, but they contain more information - interpolation even enhances it. It seems that the layout algorithm on the x86 machine uses the InterpolationMode property, while x64 just changes the palette values without taking into account any interpolation.
I never noticed any difference between the output of the two machines until the day when I applied the histogram view function to the data in my application. On the x86 machine, it is balanced, as you would expect from viewing images. On the other hand, an x64 machine would rather suggest some kind of sparse line chart, indicating indexed image data. It even affects the overall output of the entire application - the output differs on both machines with the same data, which is not very good.
For me, this seems like an error in the implementation of x64, but it's just me :-). I just want the images on the x64 machine to have the same values as x86.
If anyone has an idea, I will be very pleased. I've been looking for this kind of behavior on the net for ages, but resistance seems futile :)
Oh look ... a whale!