~phablet-team/qtubuntu-camera/staging

« back to all changes in this revision

Viewing changes to src/aalimageencodercontrol.cpp

  • Committer: Florian Boucault
  • Author(s): Florian Boucault
  • Date: 2015-12-18 14:16:09 UTC
  • mfrom: (164.2.3 limit_exif_thumbnail_size)
  • Revision ID: florian_boucault-20151218141609-6haz5k0hzdqrjdp4
Limit thumbnail sizes to be at most 128x128 which ensures it never exceeds the EXIF metadata limit of 64KB.

Fixes bug lp:1519766

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
 
165
165
    // Set the optimal thumbnail image resolution that will be saved to the JPEG file
166
166
    if (!m_availableThumbnailSizes.empty()) {
167
 
        m_currentThumbnailSize = m_service->selectSizeWithAspectRatio(m_availableThumbnailSizes, imageAspectRatio);
 
167
        // Because EXIF thumbnails must be at most 64KB by specification, make sure that
 
168
        // we request thumbnails that are no bigger than 128x128x4 bytes uncompressed
 
169
        // which will ensure that when JPEG compressed they are under 64KB.
 
170
        // Fixes bug https://bugs.launchpad.net/ubuntu/+source/camera-app/+bug/1519766
 
171
        if (imageAspectRatio >= 1.0) {
 
172
            m_currentThumbnailSize = QSize(128, (int)(128.0f / imageAspectRatio));
 
173
        } else {
 
174
            m_currentThumbnailSize = QSize((int)(128.0f * imageAspectRatio), 128);
 
175
        }
168
176
        thumbnailAspectRatio = (float)m_currentThumbnailSize.width() / (float)m_currentThumbnailSize.height();
169
177
    }
170
178