MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / EncodeWebp

Function EncodeWebp

Telegram/SourceFiles/boxes/sticker_creator_box.cpp:180–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180[[nodiscard]] QByteArray EncodeWebp(QImage image) {
181 if (image.size() != QSize(kStickerSide, kStickerSide)) {
182 image = image.scaled(
183 kStickerSide,
184 kStickerSide,
185 Qt::IgnoreAspectRatio,
186 Qt::SmoothTransformation);
187 }
188 if (image.format() != QImage::Format_ARGB32) {
189 image = image.convertToFormat(QImage::Format_ARGB32);
190 }
191 auto bytes = QByteArray();
192 auto buffer = QBuffer(&bytes);
193 buffer.open(QIODevice::WriteOnly);
194 image.save(&buffer, "WEBP", kWebpQuality);
195 return bytes;
196}
197
198} // namespace
199

Callers 1

CreateStickerBoxFunction · 0.85

Calls 6

QByteArrayClass · 0.85
scaledMethod · 0.80
sizeMethod · 0.45
formatMethod · 0.45
openMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected