Add grayscale export image option. Fixed #288

This commit is contained in:
Vadim Kuznetsov 2023-07-05 09:20:11 +03:00
parent 8331d5f7e7
commit 1c97baa660
3 changed files with 8 additions and 2 deletions

View File

@ -72,7 +72,7 @@ ExportDialog::ExportDialog(int w, int h, int wsel, int hsel, QString filename_,
cbxImgType = new QComboBox(this);
QStringList lst;
lst<<tr("Colour")<<tr("Monochrome");
lst<<tr("Colour")<<tr("Grayscale")<<tr("Monochrome");
cbxImgType->addItems(lst);
cbRatio = new QCheckBox(tr("Original width to height ratio"));
@ -365,6 +365,9 @@ ExportDialog::ImgFormat ExportDialog::getImgFormat()
ImgFormat = ExportDialog::Coloured;
break;
case 1 :
ImgFormat = ExportDialog::Grayscale;
break;
case 2 :
ImgFormat = ExportDialog::Monochrome;
break;
default : break;

View File

@ -72,7 +72,7 @@ private:
public:
enum ImgFormat {Coloured, Monochrome};
enum ImgFormat {Coloured, Monochrome, Grayscale};
QString FileToSave();
bool isOriginalSize();

View File

@ -199,6 +199,9 @@ int ImageWriter::print(QWidget *doc)
case ExportDialog::Coloured :
img = new QImage(w,h,QImage::Format_RGB888);
break;
case ExportDialog::Grayscale :
img = new QImage(w,h,QImage::Format_Grayscale8);
break;
case ExportDialog::Monochrome :
img = new QImage(w,h,QImage::Format_Mono);
break;