Hi,
I am developing a freeware application that uses 16bit/channel PNG files to do some image-processing for amateur astronomers. Ive setup the code in Linux (FPC3.2.2) and it works fine. I can load files and access the data easily, processing works fine too.
The code to load the PNG into memory looks like this:
Procedure LoadImagetoMemory(filename:string);var Ext:string;
begin
ext:=ExtractFileExt(filename);
if (ext='.png') then
begin
MemoryImage := TFPMemoryImage.Create(0,0);
MemoryImage.Loadfromfile(filename);
end;
end;
memoryimage is earlier declared as MemoryImage: TFPMemoryImage;
In a button Click procedure I have this code:
....
OpenPictureDialog1.Execute;
if (OpenPictureDialog1.Files.Count = 1) and (FileExists(OpenPictureDialog1.FileName)) then
begin
ScreenImage.Picture.LoadFromFile(OpenPictureDialog1.FileName);
LoadImageToMemory(OpenPictureDialog1.FileName); end;
As stated this works perfectly on Linux but on windows the 1st call (screenimage.Picture.Loadfromfile(...)) does
work and the image gets displayed on screen. But the second call (loadImageToMemory) simply fails with a
"FILE NOT OPEN" error. Originally I did not have (since I do not need it) the call to screenimage.picture.loadfromfile but
I wanted to see if I could isolate the problem at least before asking for help. It looks as if the MemoryImage system after cross-compiling for windows does not work the same as in Linux.
I would like to hear how I can bypass this ? Ive also thought about using the BGRABitmap system, the TexpandedBitmap seems
a good candidate but I have not seen code that uses it for a 16bit PNG usecase like mine.
kind regards
Cor Berrevoets
*************************************************
RegiStax Free Image Processing Software
http://www.astronomie.be/registax*************************************************
TeensyBat Bat Detector
https://github.com/C...nsy_batdetector