I'm processing many images in separate threads for speed.
This code fails randomly with 'Cannot create TIECanvas. Ensure GDI+ is installed on system.'
ieBitmap := TIEBitmap.Create;
try
ieBitmap.Read(paperStream);
paperStream.Clear;
iImageEnProc := TImageEnProc.CreateFromBitmap(ieBitmap);
try
iImageEnProc.Resample(newWidth, newHeight, rfFastLinear, True);
finally
iImageEnProc.Free;
end;
iImageEnIO := TImageEnIO.CreateFromBitmap(ieBitmap);
try
iImageEnIO.SaveToStreamJpeg(paperStream);
finally
iImageEnIO.Free;
end;
finally
ieBitmap.Free;
end;
It fails specifically at the line:
iImageEnIO.SaveToStreamJpeg(paperStream);
I've tried writing this just using TIEBitmap but that produces the same error. If I wrap the whole code block in a synchronise procedure it works fine but obviously slow the process making threads redundant.