I am using Qt and saving a image file out of a QML UI item. Following is what I do
auto screenshot = quick_item->grabToImage();
screenshot->saveToFile("/somepath/filename.jpeg");
// OR sometimes use like png like
screenshot->saveToFile("/somepath/filename.png");
This is works fantastically well on all platforms. I open the file the image is saved as intended.
Now my question is:
I just mentioned .jpeg as file extension while providing the filename as param into saveToFile. This works but, should I need to use QImageWriter to ensure that the image is actually compressed in jpeg/png format ?
What happens when it is a lossy compression like jpeg?
How to control a lossy compression if I want to like in android I can do a image.compress(CompressFormat.JPEG, 80, stream) where 80 is the percentage of quality for Compress ?