Putting NSImageMBS in a CVPixelBufferMBS


I need to put some NSImageMBS pictures in a CVPixelBufferMBS object.
The CVPixelBufferMBS constructors can either take a regular Xojo picture or a width and height where the data can be set later.

For the first case, I can construct the CVPixelBufferMBS object with a Xojo picture, using MyNSImage.CopyPicture, then draw subsequent pictures inside that one (as the example provides). However, with this method, I’m concerned about the picture quality. Does NSImageMBS lose quality when using CopyPicture?

The second case creates a buffer with the wanted size, but then I have to fill it. While the NSImageMBS has several methods to convert the picture to a string, they are formatted (returned as jpg, png, etc.), not suitable for the CVPixelBufferMBS class.

Perhaps there’s a lossless way I’ve not found?