Hi everyone,
I have just experienced a very strange behaviour and got stuck...
I have written a console program which works pretty well in Windows7 but
gives strange, unpredictable and not repeatable results when executed in Windows10.
If executed in Win10 it runs properly producing no errors however
the results are slightly different from those produced if executed in Windows7.
The code basically calls the ImageMagick using RunCommandInDir and gets IM_Metric string in return (see below)
...
// compare CurrentFile with PatternImage
RunCommandInDir(FolderToProcess,EDOPath.ImageMagick+'convert.exe',IM_Params,IM_Metric);
SetLength(IM_Metric,Length(IM_Metric)-2); // remove LF and CR
Val(IM_Metric,FL[CurrentFile-1].Distortion,c);
...
What the ImageMagick does (achieved by passing the IM_Params) is the following:
- reads the image
- crops and trims the image
- writes the resulting image to the png file
- compares the resulting image with the pattern image
- writes the result (string) to TXT file
- writes the result (string) to StdOut (passes to my program)
I made a lot of tests and the outcome is the following:
- Running ImageMagick alone (just from console and not from my program) works fine both in Win7 and Win10
- Calling ImageMagick from my program in Win7 gives correct results
- Calling ImageMagick from my program in Win10 gives correct results except p.6 above (passing the information back to my program). Occasionally instead of passing the right data it passes "0" and it does not follow any pattern: processing 662 image files may give 0, 1, 2, 3 or more (different every time) wrong results ("0") passed to my program...
- Calling ImageMagick from my program in Win10 but running my program with Compatibility Mode set to Windows7 gives correct results
I tried to find some switches for the compiler that would help sorting this out but failed to find anything useful...
Program is compiled for Win64 using FPC 3.0.0 with Lazarus 1.6 (SVN 51630) running in Win7 64bit
Does anyone of you experienced anything similar?
Would appreciate any help that could move me forward..
Thanks in advance!
Wojtek