While testing those changes, I was surprised to see my "jpg" file on ramdisk briefly jump to the raw data's 3.5MB size, then drop to the 200K JPEG size.
This is due to ImageStreamCaptureHandler and the underlying stream base class writing image data to the stream in Process, then copying it back to memory in PostProcess to invoke OnManipulate. The initial output seems like unnecessary overhead. It's trivial in my ramdisk scenario, but it would make a bigger difference on slower physical media (especially SD cards).
It seems to me that if Manipulate is called with a target ImageFormat, we need sort of a hybrid of InMemoryCaptureHandlerProcess to accumulate image data in memory, and the output stage of StreamCaptureHandlerPostProcess to invoke manipulation and write the results to a pathname. (In fact, maybe it should work the same way even when ImageFormat is null. Then you'd be storing a raw file.)
I'm not sure of the best way to resolve this, but after thinking about it more, it didn't really belong in that PR.
This is another spinoff from PR #175.
While testing those changes, I was surprised to see my "jpg" file on ramdisk briefly jump to the raw data's 3.5MB size, then drop to the 200K JPEG size.
This is due to
ImageStreamCaptureHandler
and the underlying stream base class writing image data to the stream inProcess
, then copying it back to memory inPostProcess
to invokeOnManipulate
. The initial output seems like unnecessary overhead. It's trivial in my ramdisk scenario, but it would make a bigger difference on slower physical media (especially SD cards).It seems to me that if
Manipulate
is called with a targetImageFormat
, we need sort of a hybrid ofInMemoryCaptureHandler
Process
to accumulate image data in memory, and the output stage ofStreamCaptureHandler
PostProcess
to invoke manipulation and write the results to a pathname. (In fact, maybe it should work the same way even whenImageFormat
is null. Then you'd be storing a raw file.)I'm not sure of the best way to resolve this, but after thinking about it more, it didn't really belong in that PR.