switched all image outputs to jpeg format instead of png

This commit is contained in:
csoler 2023-01-16 19:53:20 +01:00
parent f65a761c9d
commit 0a8f4b1b6e
14 changed files with 16 additions and 16 deletions

View File

@ -577,7 +577,7 @@ void IdEditDialog::createId()
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
mAvatar.save(&buffer, "PNG"); // writes image into ba in PNG format mAvatar.save(&buffer, "JPG"); // writes image into ba in PNG format
params.mImage.copy((uint8_t *) ba.data(), ba.size()); params.mImage.copy((uint8_t *) ba.data(), ba.size());
} }
@ -649,7 +649,7 @@ void IdEditDialog::updateId()
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
mAvatar.save(&buffer, "PNG"); // writes image into ba in PNG format mAvatar.save(&buffer, "JPG"); // writes image into ba in PNG format
mEditGroup.mImage.copy((uint8_t *) ba.data(), ba.size()); mEditGroup.mImage.copy((uint8_t *) ba.data(), ba.size());
} }

View File

@ -115,7 +115,7 @@ void AlbumGroupDialog::prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaD
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format pixmap.save(&buffer, "JPG"); // writes image into ba in PNG format
group.mThumbnail.copy((uint8_t *) ba.data(), ba.size()); group.mThumbnail.copy((uint8_t *) ba.data(), ba.size());
} else { } else {

View File

@ -47,7 +47,7 @@ void AlbumItem::setUp()
if(mAlbum.mThumbnail.mSize != 0) if(mAlbum.mThumbnail.mSize != 0)
{ {
QPixmap qtn; QPixmap qtn;
qtn.loadFromData(mAlbum.mThumbnail.mData, mAlbum.mThumbnail.mSize, "PNG"); qtn.loadFromData(mAlbum.mThumbnail.mData, mAlbum.mThumbnail.mSize, "JPG");
ui->label_Thumbnail->setPixmap(qtn); ui->label_Thumbnail->setPixmap(qtn);
} }
else else

View File

@ -330,7 +330,7 @@ void BoardPostDisplayWidget_compact::setup()
#ifdef DEBUG_BOARDPOSTDISPLAYWIDGET #ifdef DEBUG_BOARDPOSTDISPLAYWIDGET
std::cerr << "Got pixmap of size " << pixmap.width() << " x " << pixmap.height() << std::endl; std::cerr << "Got pixmap of size " << pixmap.width() << " x " << pixmap.height() << std::endl;
std::cerr << "Saving to pix.png" << std::endl; std::cerr << "Saving to pix.png" << std::endl;
pixmap.save("pix.png","PNG"); pixmap.save("pix.png","JPG");
#endif #endif
ui->pictureLabel->setPicture(pixmap); ui->pictureLabel->setPicture(pixmap);

View File

@ -105,7 +105,7 @@ void PostedGroupDialog::preparePostedGroup(RsPostedGroup &group, const RsGroupMe
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format pixmap.save(&buffer, "JPG"); // writes image into ba in PNG format
group.mGroupImage.copy((uint8_t *) ba.data(), ba.size()); group.mGroupImage.copy((uint8_t *) ba.data(), ba.size());
} else { } else {

View File

@ -109,7 +109,7 @@ void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format pixmap.save(&buffer, "JPG"); // writes image into ba in PNG format
group.mHeadshot.copy((uint8_t *) ba.data(), ba.size()); group.mHeadshot.copy((uint8_t *) ba.data(), ba.size());
} else { } else {

View File

@ -1094,7 +1094,7 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
QImage image(icon.pixmap(height,height).toImage()); QImage image(icon.pixmap(height,height).toImage());
QByteArray byteArray; QByteArray byteArray;
QBuffer buffer(&byteArray); QBuffer buffer(&byteArray);
image.save(&buffer, "PNG"); // writes the image in PNG format inside the buffer image.save(&buffer, "JPG"); // writes the image in PNG format inside the buffer
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data()); QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
strPreName = QString("<img src=\"data:image/png;base64,%1\" alt=\"[unsigned]\" />").arg(iconBase64); strPreName = QString("<img src=\"data:image/png;base64,%1\" alt=\"[unsigned]\" />").arg(iconBase64);
} }

View File

@ -141,7 +141,7 @@ void AvatarDialog::getAvatar(QByteArray &avatar)
QBuffer buffer(&avatar); QBuffer buffer(&avatar);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format pixmap.save(&buffer, "JPG"); // writes image into ba in PNG format
} }
void AvatarDialog::load() void AvatarDialog::load()

View File

@ -611,7 +611,7 @@ bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){
QByteArray ba; QByteArray ba;
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
tNail.save(&buffer, "PNG"); tNail.save(&buffer, "JPG");
QPixmap img; QPixmap img;
img.loadFromData(ba, "PNG"); img.loadFromData(ba, "PNG");
img = img.scaled(thumbnail_label->width(), thumbnail_label->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); img = img.scaled(thumbnail_label->width(), thumbnail_label->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
@ -814,7 +814,7 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str
// send chan image // send chan image
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
preview_W->getCroppedScaledPicture().save(&buffer, "PNG"); // writes image into ba in PNG format preview_W->getCroppedScaledPicture().save(&buffer, "JPG"); // writes image into ba in PNG format
post.mThumbnail.copy((uint8_t *) ba.data(), ba.size()); post.mThumbnail.copy((uint8_t *) ba.data(), ba.size());
} }

View File

@ -120,7 +120,7 @@ void GxsChannelGroupDialog::prepareChannelGroup(RsGxsChannelGroup &group, const
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format pixmap.save(&buffer, "JPG"); // writes image into ba in PNG format
group.mImage.copy((uint8_t *) ba.data(), ba.size()); group.mImage.copy((uint8_t *) ba.data(), ba.size());
} else { } else {

View File

@ -350,7 +350,7 @@ void ZoomableLabel::updateView()
std::cerr << " Image size: " << mFullImage.width() << " x " << mFullImage.height() << ", window size: " << width() << " x " << height() << std::endl; std::cerr << " Image size: " << mFullImage.width() << " x " << mFullImage.height() << ", window size: " << width() << " x " << height() << std::endl;
std::cerr << " cropped image: " << rect.left() << "," << rect.top() << "+" << rect.width() << "+" << rect.height() << std::endl; std::cerr << " cropped image: " << rect.left() << "," << rect.top() << "+" << rect.width() << "+" << rect.height() << std::endl;
std::cerr << " saving crop to pix2.png" << std::endl; std::cerr << " saving crop to pix2.png" << std::endl;
mFullImage.copy(rect).save("pix2.png","PNG"); mFullImage.copy(rect).save("pix2.png","JPG");
#endif #endif
QLabel::setPixmap(mFullImage.copy(rect)); QLabel::setPixmap(mFullImage.copy(rect));
} }

View File

@ -164,7 +164,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
// { // {
// QFile file("yourFile.png"); // QFile file("yourFile.png");
// file.open(QIODevice::WriteOnly); // file.open(QIODevice::WriteOnly);
// pixmap.save(&file, "PNG"); // pixmap.save(&file, "JPG");
// file.close(); // file.close();
// } // }

View File

@ -166,7 +166,7 @@ int ImageUtil::checkSize(QByteArray &bytearray, const QImage &img)
//std::cout << QString("Trying image: format PNG, size %1x%2, colors %3\n").arg(img.width()).arg(img.height()).arg(img.colorCount()).toStdString(); //std::cout << QString("Trying image: format PNG, size %1x%2, colors %3\n").arg(img.width()).arg(img.height()).arg(img.colorCount()).toStdString();
if (buffer.open(QIODevice::WriteOnly)) { if (buffer.open(QIODevice::WriteOnly)) {
if (img.save(&buffer, "PNG", 0)) { if (img.save(&buffer, "JPG", 0)) {
size = bytearray.length(); size = bytearray.length();
} else { } else {
std::cerr << "ImageUtil: image can't be saved to buffer" << std::endl; std::cerr << "ImageUtil: image can't be saved to buffer" << std::endl;

View File

@ -291,7 +291,7 @@ bool misc::getOpenAvatarPicture(QWidget *parent, QByteArray &image_data)
// save image in QByteArray // save image in QByteArray
QBuffer buffer(&image_data); QBuffer buffer(&image_data);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "PNG"); // writes image into ba in PNG format picture.save(&buffer, "JPG"); // writes image into ba in JPG format
return true; return true;
} }