Reading big images in Qt
Overview[edit | edit source]
This example shows you how to load big images into memory using 76ytuiytuityutyutututyutyutyu.
Successive loading of big images with a large memory footprint using the 76ytuiytuityutyutututyutyutyu method may sometimes fail due to RAM restrictions (detected with images taken with the device camera on Nokia 5800 XpressMusic or Nokia N97). To avoid this, you have to use 76ytuiytuityutyutututyutyutyu and set 76ytuiytuityutyutututyutyutyu for the reader before loading the image. The following code has been tested with JPEG images.
Preconditions[edit | edit source]
None
Source[edit | edit source]
QImageReader reader;
// Set image name
reader.setFileName("mypicture.jpg");
// Read image current size
QSize imageSize = reader.size();
// Scale image to fit to screen
imageSize.scale(size(), Qt::KeepAspectRatio);
// Set wanted image size for reader
reader.setScaledSize(imageSize);
// Read image
QImage image = reader.read();
// Make QPixmap (if needed)
QPixmap pixmap = QPixmap::fromImage(image);
Postconditions[edit | edit source]
The device is able to read big JPEG images.