Unsolved How could Camera take photo into buffer instead of saving?
-
Hi,
I know there were many guys already asking this problem when I search on this topic. For example, on StackOverflow and on this forum. But so far I don't see any perfect solution, the purposed ideas are:
- After the picture is saved into flash/disk, read it out and delete the saved one. This has performed two IO operations, not friendly enough and requires lots of code.
- Set CapturetoBuffer, but somebody said this is not promising to work on every platform (e.g. IOS). And I tried with QML : imgCap.setCaptureDestination = CameraCapture.CaptureToBuffer, when running there is no error but it does still save to flash.
since the posts are a bit old (two or more years ago), I just wonder if now Qt/QML has better support for this? And I wonder why consider this functionality at the first design since it has lots of usage for example QR scanning.
Thanks
-
@ajee Hi, could it be possible to create a QPixmap from the image and then use save() method ?
QPixmap m_px = QPixmap::fromImage(newImage); // doc : https://wiki.qt.io/Converting_QPixmap_to_QByteArray QByteArray bArray; QBuffer buffer(&bArray); buffer.open(QIODevice::WriteOnly); m_px.save(&buffer, "PNG");
-
@LeLev Thanks. But my question is, taking photo from Camera , don't save it to flash but to buffer. What you purpose is still saving the picture to flash (default behavior of Camera ), then read it again from this saved image.
-
@ajee yes. My bad, sry
-
Hi,
Not all platforms implements the
QCameraCaptureDestinationControl
interface (as it might not be always possible depending on the platform). So it might indeed not work as you would like.However plugins are not written in stone, so you may take a look and add it to the platform you are interested in.
It's nothing QML is responsible for.