Faster png save with still good compression, fixes #4045
This commit is contained in:
@@ -1194,7 +1194,6 @@ SAVEDLG_AUTOSUFFIX;Automatically add a suffix if the file already exists
|
|||||||
SAVEDLG_FILEFORMAT;File format
|
SAVEDLG_FILEFORMAT;File format
|
||||||
SAVEDLG_FORCEFORMATOPTS;Force saving options
|
SAVEDLG_FORCEFORMATOPTS;Force saving options
|
||||||
SAVEDLG_JPEGQUAL;JPEG quality
|
SAVEDLG_JPEGQUAL;JPEG quality
|
||||||
SAVEDLG_PNGCOMPR;PNG compression
|
|
||||||
SAVEDLG_PUTTOQUEUE;Put into processing queue
|
SAVEDLG_PUTTOQUEUE;Put into processing queue
|
||||||
SAVEDLG_PUTTOQUEUEHEAD;Put to the head of the processing queue
|
SAVEDLG_PUTTOQUEUEHEAD;Put to the head of the processing queue
|
||||||
SAVEDLG_PUTTOQUEUETAIL;Put to the end of the processing queue
|
SAVEDLG_PUTTOQUEUETAIL;Put to the end of the processing queue
|
||||||
|
@@ -1751,7 +1751,7 @@ public:
|
|||||||
* @param compression is the amount of compression (0-6), -1 corresponds to the default
|
* @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
|
* @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 */
|
@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.
|
/** @brief Saves the image to file in a jpg format.
|
||||||
* @param fname is the name of the file
|
* @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
|
* @param quality is the quality of the jpeg (0...100), set it to -1 to use default
|
||||||
|
@@ -75,9 +75,9 @@ public:
|
|||||||
{
|
{
|
||||||
return save (fname);
|
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)
|
virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3)
|
||||||
{
|
{
|
||||||
|
@@ -70,9 +70,9 @@ public:
|
|||||||
{
|
{
|
||||||
return save (fname);
|
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)
|
virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3)
|
||||||
{
|
{
|
||||||
|
@@ -79,9 +79,9 @@ public:
|
|||||||
{
|
{
|
||||||
return save (fname);
|
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)
|
virtual int saveAsJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3)
|
||||||
{
|
{
|
||||||
|
@@ -905,7 +905,7 @@ int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s
|
|||||||
return IMIO_SUCCESS;
|
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) {
|
if (getWidth() < 1 || getHeight() < 1) {
|
||||||
return IMIO_HEADERERROR;
|
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_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 width = getWidth ();
|
||||||
int height = getHeight ();
|
int height = getHeight ();
|
||||||
|
@@ -136,7 +136,7 @@ public:
|
|||||||
int loadJPEGFromMemory (const char* buffer, int bufsize);
|
int loadJPEGFromMemory (const char* buffer, int bufsize);
|
||||||
int loadPPMFromMemory(const char* buffer, int width, int height, bool swap, int bps);
|
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 saveJPEG (Glib::ustring fname, int quality = 100, int subSamp = 3);
|
||||||
int saveTIFF (Glib::ustring fname, int bps = -1, bool uncompressed = false);
|
int saveTIFF (Glib::ustring fname, int bps = -1, bool uncompressed = false);
|
||||||
|
|
||||||
|
@@ -245,7 +245,7 @@ bool BatchQueue::saveBatchQueue ()
|
|||||||
file << entry->filename << '|' << entry->savedParamsFile << '|' << entry->outFileName << '|' << saveFormat.format << '|'
|
file << entry->filename << '|' << entry->savedParamsFile << '|' << entry->outFileName << '|' << saveFormat.format << '|'
|
||||||
#endif
|
#endif
|
||||||
<< saveFormat.jpegQuality << '|' << saveFormat.jpegSubSamp << '|'
|
<< saveFormat.jpegQuality << '|' << saveFormat.jpegSubSamp << '|'
|
||||||
<< saveFormat.pngBits << '|' << saveFormat.pngCompression << '|'
|
<< saveFormat.pngBits << '|'
|
||||||
<< saveFormat.tiffBits << '|' << saveFormat.tiffUncompressed << '|'
|
<< saveFormat.tiffBits << '|' << saveFormat.tiffUncompressed << '|'
|
||||||
<< saveFormat.saveParams << '|' << entry->forceFormatOpts << '|'
|
<< saveFormat.saveParams << '|' << entry->forceFormatOpts << '|'
|
||||||
<< entry->fast_pipeline << '|'
|
<< entry->fast_pipeline << '|'
|
||||||
@@ -310,7 +310,6 @@ bool BatchQueue::loadBatchQueue ()
|
|||||||
const auto jpegQuality = nextIntOr (options.saveFormat.jpegQuality);
|
const auto jpegQuality = nextIntOr (options.saveFormat.jpegQuality);
|
||||||
const auto jpegSubSamp = nextIntOr (options.saveFormat.jpegSubSamp);
|
const auto jpegSubSamp = nextIntOr (options.saveFormat.jpegSubSamp);
|
||||||
const auto pngBits = nextIntOr (options.saveFormat.pngBits);
|
const auto pngBits = nextIntOr (options.saveFormat.pngBits);
|
||||||
const auto pngCompression = nextIntOr (options.saveFormat.pngCompression);
|
|
||||||
const auto tiffBits = nextIntOr (options.saveFormat.tiffBits);
|
const auto tiffBits = nextIntOr (options.saveFormat.tiffBits);
|
||||||
const auto tiffUncompressed = nextIntOr (options.saveFormat.tiffUncompressed);
|
const auto tiffUncompressed = nextIntOr (options.saveFormat.tiffUncompressed);
|
||||||
const auto saveParams = nextIntOr (options.saveFormat.saveParams);
|
const auto saveParams = nextIntOr (options.saveFormat.saveParams);
|
||||||
@@ -352,7 +351,6 @@ bool BatchQueue::loadBatchQueue ()
|
|||||||
saveFormat.jpegQuality = jpegQuality;
|
saveFormat.jpegQuality = jpegQuality;
|
||||||
saveFormat.jpegSubSamp = jpegSubSamp;
|
saveFormat.jpegSubSamp = jpegSubSamp;
|
||||||
saveFormat.pngBits = pngBits;
|
saveFormat.pngBits = pngBits;
|
||||||
saveFormat.pngCompression = pngCompression;
|
|
||||||
saveFormat.tiffBits = tiffBits;
|
saveFormat.tiffBits = tiffBits;
|
||||||
saveFormat.tiffUncompressed = tiffUncompressed != 0;
|
saveFormat.tiffUncompressed = tiffUncompressed != 0;
|
||||||
saveFormat.saveParams = saveParams != 0;
|
saveFormat.saveParams = saveParams != 0;
|
||||||
@@ -612,7 +610,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img)
|
|||||||
if (saveFormat.format == "tif") {
|
if (saveFormat.format == "tif") {
|
||||||
err = img->saveAsTIFF (fname, saveFormat.tiffBits, saveFormat.tiffUncompressed);
|
err = img->saveAsTIFF (fname, saveFormat.tiffBits, saveFormat.tiffUncompressed);
|
||||||
} else if (saveFormat.format == "png") {
|
} else if (saveFormat.format == "png") {
|
||||||
err = img->saveAsPNG (fname, saveFormat.pngCompression, saveFormat.pngBits);
|
err = img->saveAsPNG (fname, saveFormat.pngBits);
|
||||||
} else if (saveFormat.format == "jpg") {
|
} else if (saveFormat.format == "jpg") {
|
||||||
err = img->saveAsJPEG (fname, saveFormat.jpegQuality, saveFormat.jpegSubSamp);
|
err = img->saveAsJPEG (fname, saveFormat.jpegQuality, saveFormat.jpegSubSamp);
|
||||||
}
|
}
|
||||||
|
@@ -186,8 +186,6 @@ Glib::ustring BatchQueueEntry::getToolTip (int x, int y)
|
|||||||
saveFormat.jpegSubSamp == 1 ? M("SAVEDLG_SUBSAMP_1") :
|
saveFormat.jpegSubSamp == 1 ? M("SAVEDLG_SUBSAMP_1") :
|
||||||
saveFormat.jpegSubSamp == 2 ? M("SAVEDLG_SUBSAMP_2") :
|
saveFormat.jpegSubSamp == 2 ? M("SAVEDLG_SUBSAMP_2") :
|
||||||
M("SAVEDLG_SUBSAMP_3"));
|
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") {
|
} else if (saveFormat.format == "tif") {
|
||||||
if (saveFormat.tiffUncompressed) {
|
if (saveFormat.tiffUncompressed) {
|
||||||
tooltip += Glib::ustring::compose("\n%1", M("SAVEDLG_TIFFUNCOMPRESSED"));
|
tooltip += Glib::ustring::compose("\n%1", M("SAVEDLG_TIFFUNCOMPRESSED"));
|
||||||
|
@@ -1767,7 +1767,7 @@ bool EditorPanel::idle_saveImage (ProgressConnector<rtengine::IImage16*> *pc, Gl
|
|||||||
ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsTIFF), fname, sf.tiffBits, sf.tiffUncompressed),
|
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));
|
sigc::bind (sigc::mem_fun (*this, &EditorPanel::idle_imageSaved), ld, img, fname, sf, pparams));
|
||||||
else if (sf.format == "png")
|
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));
|
sigc::bind (sigc::mem_fun (*this, &EditorPanel::idle_imageSaved), ld, img, fname, sf, pparams));
|
||||||
else if (sf.format == "jpg")
|
else if (sf.format == "jpg")
|
||||||
ld->startFunc (sigc::bind (sigc::mem_fun (img, &rtengine::IImage16::saveAsJPEG), fname, sf.jpegQuality, sf.jpegSubSamp),
|
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") {
|
if (sf.format == "tif") {
|
||||||
err = img->saveAsTIFF (filename, sf.tiffBits, sf.tiffUncompressed);
|
err = img->saveAsTIFF (filename, sf.tiffBits, sf.tiffUncompressed);
|
||||||
} else if (sf.format == "png") {
|
} else if (sf.format == "png") {
|
||||||
err = img->saveAsPNG (filename, sf.pngCompression, sf.pngBits);
|
err = img->saveAsPNG (filename, sf.pngBits);
|
||||||
} else if (sf.format == "jpg") {
|
} else if (sf.format == "jpg") {
|
||||||
err = img->saveAsJPEG (filename, sf.jpegQuality, sf.jpegSubSamp);
|
err = img->saveAsJPEG (filename, sf.jpegQuality, sf.jpegSubSamp);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -611,7 +611,7 @@ int processLineParams ( int argc, char **argv )
|
|||||||
std::cout << " -t[z] Specify output to be TIFF." << std::endl;
|
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 << " Uncompressed by default, or deflate compression with 'z'." << std::endl;
|
||||||
std::cout << " -n Specify output to be compressed PNG." << 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 << " -Y Overwrite output if present." << std::endl;
|
||||||
std::cout << " -f Use the custom fast-export processing pipeline." << std::endl;
|
std::cout << " -f Use the custom fast-export processing pipeline." << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
@@ -837,7 +837,7 @@ int processLineParams ( int argc, char **argv )
|
|||||||
} else if ( outputType == "tif" ) {
|
} else if ( outputType == "tif" ) {
|
||||||
errorCode = resultImage->saveAsTIFF ( outputFile, bits, compression == 0 );
|
errorCode = resultImage->saveAsTIFF ( outputFile, bits, compression == 0 );
|
||||||
} else if ( outputType == "png" ) {
|
} else if ( outputType == "png" ) {
|
||||||
errorCode = resultImage->saveAsPNG ( outputFile, compression, bits );
|
errorCode = resultImage->saveAsPNG ( outputFile, bits );
|
||||||
} else {
|
} else {
|
||||||
errorCode = resultImage->saveToFile (outputFile);
|
errorCode = resultImage->saveToFile (outputFile);
|
||||||
}
|
}
|
||||||
|
@@ -309,7 +309,6 @@ void Options::setDefaults ()
|
|||||||
saveFormat.format = "jpg";
|
saveFormat.format = "jpg";
|
||||||
saveFormat.jpegQuality = 92;
|
saveFormat.jpegQuality = 92;
|
||||||
saveFormat.jpegSubSamp = 2;
|
saveFormat.jpegSubSamp = 2;
|
||||||
saveFormat.pngCompression = 6;
|
|
||||||
saveFormat.pngBits = 8;
|
saveFormat.pngBits = 8;
|
||||||
saveFormat.tiffBits = 16;
|
saveFormat.tiffBits = 16;
|
||||||
saveFormat.tiffUncompressed = true;
|
saveFormat.tiffUncompressed = true;
|
||||||
@@ -318,7 +317,6 @@ void Options::setDefaults ()
|
|||||||
saveFormatBatch.format = "jpg";
|
saveFormatBatch.format = "jpg";
|
||||||
saveFormatBatch.jpegQuality = 92;
|
saveFormatBatch.jpegQuality = 92;
|
||||||
saveFormatBatch.jpegSubSamp = 2;
|
saveFormatBatch.jpegSubSamp = 2;
|
||||||
saveFormatBatch.pngCompression = 6;
|
|
||||||
saveFormatBatch.pngBits = 8;
|
saveFormatBatch.pngBits = 8;
|
||||||
saveFormatBatch.tiffBits = 16;
|
saveFormatBatch.tiffBits = 16;
|
||||||
saveFormatBatch.tiffUncompressed = true;
|
saveFormatBatch.tiffUncompressed = true;
|
||||||
@@ -790,10 +788,6 @@ void Options::readFromFile (Glib::ustring fname)
|
|||||||
saveFormat.jpegSubSamp = keyFile.get_integer ("Output", "JpegSubSamp");
|
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")) {
|
if (keyFile.has_key ("Output", "PngBps")) {
|
||||||
saveFormat.pngBits = keyFile.get_integer ("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");
|
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")) {
|
if (keyFile.has_key ("Output", "PngBpsBatch")) {
|
||||||
saveFormatBatch.pngBits = keyFile.get_integer ("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_string ("Output", "Format", saveFormat.format);
|
||||||
keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality);
|
keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality);
|
||||||
keyFile.set_integer ("Output", "JpegSubSamp", saveFormat.jpegSubSamp);
|
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", "PngBps", saveFormat.pngBits);
|
||||||
keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits);
|
keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits);
|
||||||
keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed);
|
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_string ("Output", "FormatBatch", saveFormatBatch.format);
|
||||||
keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality);
|
keyFile.set_integer ("Output", "JpegQualityBatch", saveFormatBatch.jpegQuality);
|
||||||
keyFile.set_integer ("Output", "JpegSubSampBatch", saveFormatBatch.jpegSubSamp);
|
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", "PngBpsBatch", saveFormatBatch.pngBits);
|
||||||
keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits);
|
keyFile.set_integer ("Output", "TiffBpsBatch", saveFormatBatch.tiffBits);
|
||||||
keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed);
|
keyFile.set_boolean ("Output", "TiffUncompressedBatch", saveFormatBatch.tiffUncompressed);
|
||||||
|
@@ -47,7 +47,6 @@ struct SaveFormat {
|
|||||||
SaveFormat() :
|
SaveFormat() :
|
||||||
format ("jpg"),
|
format ("jpg"),
|
||||||
pngBits (8),
|
pngBits (8),
|
||||||
pngCompression (6),
|
|
||||||
jpegQuality (90),
|
jpegQuality (90),
|
||||||
jpegSubSamp (2),
|
jpegSubSamp (2),
|
||||||
tiffBits (8),
|
tiffBits (8),
|
||||||
@@ -58,7 +57,6 @@ struct SaveFormat {
|
|||||||
|
|
||||||
Glib::ustring format;
|
Glib::ustring format;
|
||||||
int pngBits;
|
int pngBits;
|
||||||
int pngCompression;
|
|
||||||
int jpegQuality;
|
int jpegQuality;
|
||||||
int jpegSubSamp; // 1=best compression, 3=best quality
|
int jpegSubSamp; // 1=best compression, 3=best quality
|
||||||
int tiffBits;
|
int tiffBits;
|
||||||
|
@@ -82,15 +82,6 @@ SaveFormatPanel::SaveFormatPanel () : listener (nullptr)
|
|||||||
jpegOpts->attach(*jpegSubSamp, 1, 1, 1, 1);
|
jpegOpts->attach(*jpegSubSamp, 1, 1, 1, 1);
|
||||||
jpegOpts->show_all ();
|
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
|
// --------------------- TIFF OPTIONS
|
||||||
|
|
||||||
|
|
||||||
@@ -113,13 +104,11 @@ SaveFormatPanel::SaveFormatPanel () : listener (nullptr)
|
|||||||
attach (*hb1, 0, 0, 1, 1);
|
attach (*hb1, 0, 0, 1, 1);
|
||||||
attach (*jpegOpts, 0, 1, 1, 1);
|
attach (*jpegOpts, 0, 1, 1, 1);
|
||||||
attach (*tiffUncompressed, 0, 2, 1, 1);
|
attach (*tiffUncompressed, 0, 2, 1, 1);
|
||||||
attach (*pngCompr, 0, 3, 1, 1);
|
|
||||||
attach (*savesPP, 0, 4, 1, 2);
|
attach (*savesPP, 0, 4, 1, 2);
|
||||||
}
|
}
|
||||||
SaveFormatPanel::~SaveFormatPanel ()
|
SaveFormatPanel::~SaveFormatPanel ()
|
||||||
{
|
{
|
||||||
delete jpegQual;
|
delete jpegQual;
|
||||||
delete pngCompr;
|
|
||||||
delete tiffUncompressed;
|
delete tiffUncompressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +132,6 @@ void SaveFormatPanel::init (SaveFormat &sf)
|
|||||||
|
|
||||||
jpegSubSamp->set_active (sf.jpegSubSamp - 1);
|
jpegSubSamp->set_active (sf.jpegSubSamp - 1);
|
||||||
|
|
||||||
pngCompr->setValue (sf.pngCompression);
|
|
||||||
jpegQual->setValue (sf.jpegQuality);
|
jpegQual->setValue (sf.jpegQuality);
|
||||||
savesPP->set_active (sf.saveParams);
|
savesPP->set_active (sf.saveParams);
|
||||||
tiffUncompressed->set_active (sf.tiffUncompressed);
|
tiffUncompressed->set_active (sf.tiffUncompressed);
|
||||||
@@ -170,7 +158,6 @@ SaveFormat SaveFormatPanel::getFormat ()
|
|||||||
sf.tiffBits = 8;
|
sf.tiffBits = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
sf.pngCompression = (int) pngCompr->getValue ();
|
|
||||||
sf.jpegQuality = (int) jpegQual->getValue ();
|
sf.jpegQuality = (int) jpegQual->getValue ();
|
||||||
sf.jpegSubSamp = jpegSubSamp->get_active_row_number() + 1;
|
sf.jpegSubSamp = jpegSubSamp->get_active_row_number() + 1;
|
||||||
sf.tiffUncompressed = tiffUncompressed->get_active();
|
sf.tiffUncompressed = tiffUncompressed->get_active();
|
||||||
@@ -192,15 +179,12 @@ void SaveFormatPanel::formatChanged ()
|
|||||||
if (fr == "jpg") {
|
if (fr == "jpg") {
|
||||||
jpegOpts->show_all();
|
jpegOpts->show_all();
|
||||||
tiffUncompressed->hide();
|
tiffUncompressed->hide();
|
||||||
pngCompr->hide();
|
|
||||||
} else if (fr == "png") {
|
} else if (fr == "png") {
|
||||||
jpegOpts->hide();
|
jpegOpts->hide();
|
||||||
tiffUncompressed->hide();
|
tiffUncompressed->hide();
|
||||||
pngCompr->show_all();
|
|
||||||
} else if (fr == "tif") {
|
} else if (fr == "tif") {
|
||||||
jpegOpts->hide();
|
jpegOpts->hide();
|
||||||
tiffUncompressed->show_all();
|
tiffUncompressed->show_all();
|
||||||
pngCompr->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener) {
|
if (listener) {
|
||||||
|
@@ -37,7 +37,6 @@ class SaveFormatPanel : public Gtk::Grid, public AdjusterListener
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Adjuster* jpegQual;
|
Adjuster* jpegQual;
|
||||||
Adjuster* pngCompr;
|
|
||||||
Gtk::CheckButton* tiffUncompressed;
|
Gtk::CheckButton* tiffUncompressed;
|
||||||
MyComboBoxText* format;
|
MyComboBoxText* format;
|
||||||
MyComboBoxText* jpegSubSamp;
|
MyComboBoxText* jpegSubSamp;
|
||||||
|
Reference in New Issue
Block a user