Hi,
I'm trying to manipulate an image that I receive to a function as TStream.
I want to load it from memory and avoid writing to files.
// input variable declared as:
inImage: TStream;
// "lump" variable declared as:
imgLump: Array of TILubyte;
// in the function I do as follows:
// setting input image into a "lump"
SetLength(imgLump, inImage.Size);
// rewind stream to beginning
inImage.Seek(0, soBeginning);
// read stream and write into array
inImage.Read(imgLump[0], inImage.Size);
loaded := ilLoadL(IL_JPG, imgLump, Length(imgLump));
// ------------------------
at this stage, loaded gets the value 0 (IL_FALSE) and the call to ilGetError() returns 1298 (IL_FILE_READ_ERROR).
why?! what did I miss?
Thanks,
Ilan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Obviously. It's the first thing being done at the top of the function.
If I use ilLoadImage instead, it works. I still wish to use a stream as the data source.
Assume the data copied into the array is a valid image data.
Any other ideas? can somebody use the latest version and verify this as a bug?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm trying to manipulate an image that I receive to a function as TStream.
I want to load it from memory and avoid writing to files.
// input variable declared as:
inImage: TStream;
// "lump" variable declared as:
imgLump: Array of TILubyte;
// in the function I do as follows:
// setting input image into a "lump"
SetLength(imgLump, inImage.Size);
// rewind stream to beginning
inImage.Seek(0, soBeginning);
// read stream and write into array
inImage.Read(imgLump[0], inImage.Size);
loaded := ilLoadL(IL_JPG, imgLump, Length(imgLump));
// ------------------------
at this stage, loaded gets the value 0 (IL_FALSE) and the call to ilGetError() returns 1298 (IL_FILE_READ_ERROR).
why?! what did I miss?
Thanks,
Ilan
Have you called ilInit?
Obviously. It's the first thing being done at the top of the function.
If I use ilLoadImage instead, it works. I still wish to use a stream as the data source.
Assume the data copied into the array is a valid image data.
Any other ideas? can somebody use the latest version and verify this as a bug?
Thanks