Bug 356931 - webp is saved in very low quality (like -q 0)
Summary: webp is saved in very low quality (like -q 0)
Status: RESOLVED UPSTREAM
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-20 05:17 UTC by FabiB
Modified: 2017-11-10 20:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description FabiB 2015-12-20 05:17:15 UTC
since plasma now supports webp natively i wanted to convert my wallpapers to webp to save some spave on my ssd.
first i tried with "cwebp" (the native convert tool and even without an option for quality (-q 0-100) it does a good job.

but i wanted to try gwenview too. gwenview seems to set to quality option to 0. so its maximum small but the quality is bad. you cant use the picture after that anymore.

Reproducible: Always

Steps to Reproduce:
1. find some good picture and open it with gwenview
2. file -> save as -> name.webp
3. close gwenview(!) and open you newly created webp

Actual Results:  
its really bad quality.. you'll just see artifacts

Expected Results:  
it should be in the same quality as with the tool cwebp 

Usage:

   cwebp [options] -q quality input.png -o output.webp

where quality is between 0 (poor) to 100 (very good).
Typical value is around 80.
Comment 1 Nate Graham 2017-11-10 18:31:02 UTC
Oh wow, this is horrible.
Comment 2 Nate Graham 2017-11-10 20:00:30 UTC
Looks like we're just using the standard QImageWriter. From documentloadedimpl.cpp:

bool DocumentLoadedImpl::saveInternal(QIODevice* device, const QByteArray& format)
{
    QImageWriter writer(device, format);
    bool ok = writer.write(document()->image());
    if (ok) {
        setDocumentFormat(format);
    } else {
        setDocumentErrorString(writer.errorString());
    }
    return ok;
}

This seems to be Qt bug in how webp images are saved; adding "writer.setQuality(100);" before we call writer.write() doesn't have any effect. I've filed https://bugreports.qt.io/browse/QTBUG-64437