diff --git a/rtdata/languages/default b/rtdata/languages/default index f610a03bc..84037a6a6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1194,7 +1194,6 @@ SAVEDLG_AUTOSUFFIX;Automatically add a suffix if the file already exists SAVEDLG_FILEFORMAT;File format SAVEDLG_FORCEFORMATOPTS;Force saving options SAVEDLG_JPEGQUAL;JPEG quality -SAVEDLG_PNGCOMPR;PNG compression SAVEDLG_PUTTOQUEUE;Put into processing queue SAVEDLG_PUTTOQUEUEHEAD;Put to the head of the processing queue SAVEDLG_PUTTOQUEUETAIL;Put to the end of the processing queue diff --git a/rtengine/iimage.h b/rtengine/iimage.h index e2cd6b951..0a73a87cc 100644 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -1751,7 +1751,7 @@ public: * @param compression is the amount of compression (0-6), -1 corresponds to the default * @param bps can be 8 or 16 depending on the bits per pixels the output file will have @return the error code, 0 if none */ - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) = 0; + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) = 0; /** @brief Saves the image to file in a jpg format. * @param fname is the name of the file * @param quality is the quality of the jpeg (0...100), set it to -1 to use default diff --git a/rtengine/image16.h b/rtengine/image16.h index 0612dc614..4d74dfbc4 100644 --- a/rtengine/image16.h +++ b/rtengine/image16.h @@ -75,9 +75,9 @@ public: { return save (fname); } - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) { - return savePNG (fname, compression, bps); + return savePNG (fname, bps); } virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3) { diff --git a/rtengine/image8.h b/rtengine/image8.h index d0d7445e0..c4651a07d 100644 --- a/rtengine/image8.h +++ b/rtengine/image8.h @@ -70,9 +70,9 @@ public: { return save (fname); } - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) { - return savePNG (fname, compression, bps); + return savePNG (fname, bps); } virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3) { diff --git a/rtengine/imagefloat.h b/rtengine/imagefloat.h index 1083ac609..7348588df 100644 --- a/rtengine/imagefloat.h +++ b/rtengine/imagefloat.h @@ -79,9 +79,9 @@ public: { return save (fname); } - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1) + virtual int saveAsPNG (Glib::ustring fname, int bps = -1) { - return savePNG (fname, compression, bps); + return savePNG (fname, bps); } virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3) { diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 01bbddf13..ff9c9b559 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -905,7 +905,7 @@ int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s return IMIO_SUCCESS; } -int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps) +int ImageIO::savePNG (Glib::ustring fname, volatile int bps) { if (getWidth() < 1 || getHeight() < 1) { return IMIO_HEADERERROR; @@ -945,7 +945,9 @@ int ImageIO::savePNG (Glib::ustring fname, int compression, volatile int bps) png_set_write_fn (png, file, png_write_data, png_flush); - png_set_compression_level(png, compression); + png_set_filter(png, 0, PNG_FILTER_PAETH); + png_set_compression_level(png, 6); + png_set_compression_strategy(png, 3); int width = getWidth (); int height = getHeight (); diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 372f42380..4c0cd56c5 100644 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -136,7 +136,7 @@ public: int loadJPEGFromMemory (const char* buffer, int bufsize); int loadPPMFromMemory(const char* buffer, int width, int height, bool swap, int bps); - int savePNG (Glib::ustring fname, int compression = -1, volatile int bps = -1); + int savePNG (Glib::ustring fname, volatile int bps = -1); int saveJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3); int saveTIFF (Glib::ustring fname, int bps = -1, bool uncompressed = false); diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index c2f4e860c..43ee5d79d 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -245,7 +245,7 @@ bool BatchQueue::saveBatchQueue () file << entry->filename << '|' << entry->savedParamsFile << '|' << entry->outFileName << '|' << saveFormat.format << '|' #endif << saveFormat.jpegQuality << '|' << saveFormat.jpegSubSamp << '|' - << saveFormat.pngBits << '|' << saveFormat.pngCompression << '|' + << saveFormat.pngBits << '|' << saveFormat.tiffBits << '|' << saveFormat.tiffUncompressed << '|' << saveFormat.saveParams << '|' << entry->forceFormatOpts << '|' << entry->fast_pipeline << '|' @@ -310,7 +310,6 @@ bool BatchQueue::loadBatchQueue () const auto jpegQuality = nextIntOr (options.saveFormat.jpegQuality); const auto jpegSubSamp = nextIntOr (options.saveFormat.jpegSubSamp); const auto pngBits = nextIntOr (options.saveFormat.pngBits); - const auto pngCompression = nextIntOr (options.saveFormat.pngCompression); const auto tiffBits = nextIntOr (options.saveFormat.tiffBits); const auto tiffUncompressed = nextIntOr (options.saveFormat.tiffUncompressed); const auto saveParams = nextIntOr (options.saveFormat.saveParams); @@ -352,7 +351,6 @@ bool BatchQueue::loadBatchQueue () saveFormat.jpegQuality = jpegQuality; saveFormat.jpegSubSamp = jpegSubSamp; saveFormat.pngBits = pngBits; - saveFormat.pngCompression = pngCompression; saveFormat.tiffBits = tiffBits; saveFormat.tiffUncompressed = tiffUncompressed != 0; saveFormat.saveParams = saveParams != 0; @@ -612,7 +610,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) if (saveFormat.format == "tif") { err = img->saveAsTIFF (fname, saveFormat.tiffBits, saveFormat.tiffUncompressed); } else if (saveFormat.format == "png") { - err = img->saveAsPNG (fname, saveFormat.pngCompression, saveFormat.pngBits); + err = img->saveAsPNG (fname, saveFormat.pngBits); } else if (saveFormat.format == "jpg") { err = img->saveAsJPEG (fname, saveFormat.jpegQuality, saveFormat.jpegSubSamp); } diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index 98c21f160..3092d6db4 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -186,8 +186,6 @@ Glib::ustring BatchQueueEntry::getToolTip (int x, int y) saveFormat.jpegSubSamp == 1 ? M("SAVEDLG_SUBSAMP_1") : saveFormat.jpegSubSamp == 2 ? M("SAVEDLG_SUBSAMP_2") : M("SAVEDLG_SUBSAMP_3")); - } else if (saveFormat.format == "png") { - tooltip += Glib::ustring::compose("\n%1: %2", M("SAVEDLG_PNGCOMPR"), saveFormat.pngCompression); } else if (saveFormat.format == "tif") { if (saveFormat.tiffUncompressed) { tooltip += Glib::ustring::compose("\n%1", M("SAVEDLG_TIFFUNCOMPRESSED")); diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index f5c6aa679..c2bec8692 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1767,7 +1767,7 @@ bool EditorPanel::idle_saveImage (ProgressConnector *pc, Gl ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsTIFF), fname, sf.tiffBits, sf.tiffUncompressed), sigc::bind (sigc::mem_fun (*this, &EditorPanel::idle_imageSaved), ld, img, fname, sf, pparams)); else if (sf.format == "png") - ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsPNG), fname, sf.pngCompression, sf.pngBits), + ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsPNG), fname, sf.pngBits), sigc::bind (sigc::mem_fun (*this, &EditorPanel::idle_imageSaved), ld, img, fname, sf, pparams)); else if (sf.format == "jpg") ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsJPEG), fname, sf.jpegQuality, sf.jpegSubSamp), @@ -1982,7 +1982,7 @@ bool EditorPanel::saveImmediately (const Glib::ustring &filename, const SaveForm if (sf.format == "tif") { err = img->saveAsTIFF (filename, sf.tiffBits, sf.tiffUncompressed); } else if (sf.format == "png") { - err = img->saveAsPNG (filename, sf.pngCompression, sf.pngBits); + err = img->saveAsPNG (filename, sf.pngBits); } else if (sf.format == "jpg") { err = img->saveAsJPEG (filename, sf.jpegQuality, sf.jpegSubSamp); } else { diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index 76ed84489..1d1917e8c 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -611,7 +611,7 @@ int processLineParams ( int argc, char **argv ) std::cout << " -t[z] Specify output to be TIFF." << std::endl; std::cout << " Uncompressed by default, or deflate compression with 'z'." << std::endl; std::cout << " -n Specify output to be compressed PNG." << std::endl; - std::cout << " Compression is hard-coded to 6." << std::endl; + std::cout << " Compression is hard-coded to PNG_FILTER_PAETH, Z_RLE" << std::endl; std::cout << " -Y Overwrite output if present." << std::endl; std::cout << " -f Use the custom fast-export processing pipeline." << std::endl; std::cout << std::endl; @@ -837,7 +837,7 @@ int processLineParams ( int argc, char **argv ) } else if ( outputType == "tif" ) { errorCode = resultImage->saveAsTIFF ( outputFile, bits, compression == 0 ); } else if ( outputType == "png" ) { - errorCode = resultImage->saveAsPNG ( outputFile, compression, bits ); + errorCode = resultImage->saveAsPNG ( outputFile, bits ); } else { errorCode = resultImage->saveToFile (outputFile); } diff --git a/rtgui/options.cc b/rtgui/options.cc index 3906a293d..d1b91c3ac 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -309,7 +309,6 @@ void Options::setDefaults () saveFormat.format = "jpg"; saveFormat.jpegQuality = 92; saveFormat.jpegSubSamp = 2; - saveFormat.pngCompression = 6; saveFormat.pngBits = 8; saveFormat.tiffBits = 16; saveFormat.tiffUncompressed = true; @@ -318,7 +317,6 @@ void Options::setDefaults () saveFormatBatch.format = "jpg"; saveFormatBatch.jpegQuality = 92; saveFormatBatch.jpegSubSamp = 2; - saveFormatBatch.pngCompression = 6; saveFormatBatch.pngBits = 8; saveFormatBatch.tiffBits = 16; saveFormatBatch.tiffUncompressed = true; @@ -790,10 +788,6 @@ void Options::readFromFile (Glib::ustring fname) saveFormat.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSamp"); } - if (keyFile.has_key ("Output", "PngCompression")) { - saveFormat.pngCompression = keyFile.get_integer ("Output", "PngCompression"); - } - if (keyFile.has_key ("Output", "PngBps")) { saveFormat.pngBits = keyFile.get_integer ("Output", "PngBps"); } @@ -823,10 +817,6 @@ void Options::readFromFile (Glib::ustring fname) saveFormatBatch.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSampBatch"); } - if (keyFile.has_key ("Output", "PngCompressionBatch")) { - saveFormatBatch.pngCompression = keyFile.get_integer ("Output", "PngCompressionBatch"); - } - if (keyFile.has_key ("Output", "PngBpsBatch")) { saveFormatBatch.pngBits = keyFile.get_integer ("Output", "PngBpsBatch"); } @@ -1927,7 +1917,6 @@ void Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Output", "Format", saveFormat.format); keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); @@ -1936,7 +1925,6 @@ void Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Output", "FormatBatch", saveFormatBatch.format); keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality); keyFile.set_integer ("Output", "JpegSubSampBatch", saveFormatBatch.jpegSubSamp); - keyFile.set_integer ("Output", "PngCompressionBatch", saveFormatBatch.pngCompression); keyFile.set_integer ("Output", "PngBpsBatch", saveFormatBatch.pngBits); keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits); keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed); diff --git a/rtgui/options.h b/rtgui/options.h index 5bf77fa65..947d3b615 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -47,7 +47,6 @@ struct SaveFormat { SaveFormat() : format ("jpg"), pngBits (8), - pngCompression (6), jpegQuality (90), jpegSubSamp (2), tiffBits (8), @@ -58,7 +57,6 @@ struct SaveFormat { Glib::ustring format; int pngBits; - int pngCompression; int jpegQuality; int jpegSubSamp; // 1=best compression, 3=best quality int tiffBits; diff --git a/rtgui/saveformatpanel.cc b/rtgui/saveformatpanel.cc index cc4088741..13e687595 100644 --- a/rtgui/saveformatpanel.cc +++ b/rtgui/saveformatpanel.cc @@ -82,15 +82,6 @@ SaveFormatPanel::SaveFormatPanel () : listener (nullptr) jpegOpts->attach(*jpegSubSamp, 1, 1, 1, 1); jpegOpts->show_all (); - // --------------------- PNG OPTIONS - - - pngCompr = new Adjuster (M("SAVEDLG_PNGCOMPR"), 0, 6, 1, 6); - setExpandAlignProperties(pngCompr, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); - pngCompr->setAdjusterListener (this); - pngCompr->show_all (); - - // --------------------- TIFF OPTIONS @@ -113,13 +104,11 @@ SaveFormatPanel::SaveFormatPanel () : listener (nullptr) attach (*hb1, 0, 0, 1, 1); attach (*jpegOpts, 0, 1, 1, 1); attach (*tiffUncompressed, 0, 2, 1, 1); - attach (*pngCompr, 0, 3, 1, 1); attach (*savesPP, 0, 4, 1, 2); } SaveFormatPanel::~SaveFormatPanel () { delete jpegQual; - delete pngCompr; delete tiffUncompressed; } @@ -143,7 +132,6 @@ void SaveFormatPanel::init (SaveFormat &sf) jpegSubSamp->set_active (sf.jpegSubSamp - 1); - pngCompr->setValue (sf.pngCompression); jpegQual->setValue (sf.jpegQuality); savesPP->set_active (sf.saveParams); tiffUncompressed->set_active (sf.tiffUncompressed); @@ -170,7 +158,6 @@ SaveFormat SaveFormatPanel::getFormat () sf.tiffBits = 8; } - sf.pngCompression = (int) pngCompr->getValue (); sf.jpegQuality = (int) jpegQual->getValue (); sf.jpegSubSamp = jpegSubSamp->get_active_row_number() + 1; sf.tiffUncompressed = tiffUncompressed->get_active(); @@ -192,15 +179,12 @@ void SaveFormatPanel::formatChanged () if (fr == "jpg") { jpegOpts->show_all(); tiffUncompressed->hide(); - pngCompr->hide(); } else if (fr == "png") { jpegOpts->hide(); tiffUncompressed->hide(); - pngCompr->show_all(); } else if (fr == "tif") { jpegOpts->hide(); tiffUncompressed->show_all(); - pngCompr->hide(); } if (listener) { diff --git a/rtgui/saveformatpanel.h b/rtgui/saveformatpanel.h index c71759399..76ae7055d 100644 --- a/rtgui/saveformatpanel.h +++ b/rtgui/saveformatpanel.h @@ -37,7 +37,6 @@ class SaveFormatPanel : public Gtk::Grid, public AdjusterListener protected: Adjuster* jpegQual; - Adjuster* pngCompr; Gtk::CheckButton* tiffUncompressed; MyComboBoxText* format; MyComboBoxText* jpegSubSamp;