[Bug 307570] Don't always recompress contact photos when saving

asamk at gmx.de asamk at gmx.de
Sun Sep 30 10:00:26 BST 2012


https://bugs.kde.org/show_bug.cgi?id=307570

--- Comment #3 from asamk at gmx.de ---
no, that function is not used to store it in the vcf. It only seems useful for
debugging.

the picture is loaded and stored in the file vcardtool.cpp:
VCardLine VCardTool::createPicture( const QString &identifier, const Picture
&pic ) const
{
  VCardLine line( identifier );

  if ( pic.isIntern() ) {
    if ( !pic.data().isNull() ) {
      QByteArray input;
      QBuffer buffer( &input );
      buffer.open( QIODevice::WriteOnly );

      if ( !pic.data().hasAlphaChannel() ) {
        pic.data().save( &buffer, "JPEG" );

        line.setValue( input );
        line.addParameter( QLatin1String( "encoding" ), QLatin1String( "b" ) );
        line.addParameter( QLatin1String( "type" ), QLatin1String( "image/jpeg"
) );
      } else {
        pic.data().save( &buffer, "PNG" );

        line.setValue( input );
        line.addParameter( QLatin1String( "encoding" ), QLatin1String( "b" ) );
        line.addParameter( QLatin1String( "type" ), QLatin1String( "image/png"
) );
      }
    }
  } else if ( !pic.url().isEmpty() ) {
    line.setValue( pic.url() );
    line.addParameter( QLatin1String( "value" ), QLatin1String( "URI" ) );
  }

  return line;
}

The 75% quality I found from looking in the Qt source code, what QImage::save()
does, if no quality is specified.

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list