Implemented TIFF LZW compression
This commit is contained in:
@@ -84,7 +84,7 @@ BatchQueuePanel::BatchQueuePanel () {
|
||||
|
||||
// setup signal handlers
|
||||
outdirTemplate->signal_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
|
||||
outdirFolder->signal_current_folder_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
|
||||
outdirFolder->signal_current_folder_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::pathFolderChanged));
|
||||
useTemplate->signal_toggled().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
|
||||
useFolder->signal_toggled().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
|
||||
saveFormatPanel->setListener (this);
|
||||
@@ -229,14 +229,19 @@ bool BatchQueuePanel::canStartNext () {
|
||||
|
||||
void BatchQueuePanel::saveOptions () {
|
||||
|
||||
options.saveFormat = saveFormatPanel->getFormat ();
|
||||
options.savePathTemplate = outdirTemplate->get_text();
|
||||
options.savePathFolder = outdirFolder->get_filename();
|
||||
options.saveUsePathTemplate = useTemplate->get_active();
|
||||
options.procQueueEnabled = autoStart->get_active ();
|
||||
}
|
||||
|
||||
// We only want to save the following when it changes, \
|
||||
// since these settings are shared with editorpanel :
|
||||
void BatchQueuePanel::pathFolderChanged () {
|
||||
|
||||
options.savePathFolder = outdirFolder->get_filename();
|
||||
}
|
||||
|
||||
void BatchQueuePanel::formatChanged () {
|
||||
|
||||
saveOptions ();
|
||||
options.saveFormat = saveFormatPanel->getFormat ();
|
||||
}
|
||||
|
@@ -71,6 +71,7 @@ class BatchQueuePanel : public Gtk::VBox,
|
||||
void stopBatchProc ();
|
||||
|
||||
void saveOptions ();
|
||||
void pathFolderChanged ();
|
||||
void formatChanged ();
|
||||
};
|
||||
|
||||
|
@@ -553,7 +553,7 @@ int EditorPanel::saveImage (rtengine::IImage16* img, Glib::ustring& fname, SaveF
|
||||
ProgressConnector<int> *ld = new ProgressConnector<int>();
|
||||
img->setSaveProgressListener (parent->getProgressListener());
|
||||
if (sf.format=="tif")
|
||||
ld->startFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsTIFF), fileName, sf.tiffBits),
|
||||
ld->startFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsTIFF), fileName, sf.tiffBits, sf.tiffUncompressed),
|
||||
sigc::bind(sigc::mem_fun(*this,&EditorPanel::idle_imageSaved), ld, img, fileName,sf));
|
||||
else if (sf.format=="png")
|
||||
ld->startFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsPNG), fileName, sf.pngCompression, sf.pngBits),
|
||||
@@ -605,6 +605,8 @@ void EditorPanel::saveAsPressed () {
|
||||
SaveFormat sf = saveAsDialog->getFormat ();
|
||||
if (getExtension (fname)!=sf.format)
|
||||
fname = fname + "." + sf.format;
|
||||
|
||||
options.saveFormat = sf;
|
||||
|
||||
if (saveAsDialog->getImmediately ()) {
|
||||
// check if it exists
|
||||
@@ -670,26 +672,26 @@ bool EditorPanel::idle_sendToGimp( ProgressConnector<rtengine::IImage16*> *pc){
|
||||
|
||||
Glib::ustring fileName = Glib::ustring::compose ("%1.%2", fname, sf.format);
|
||||
|
||||
int tries = 1;
|
||||
while (Glib::file_test (fileName, Glib::FILE_TEST_EXISTS) && tries<1000) {
|
||||
fileName = Glib::ustring::compose("%1-%2.%3", fname, tries, sf.format);
|
||||
tries++;
|
||||
}
|
||||
if (tries==1000){
|
||||
img->free ();
|
||||
return false;
|
||||
}
|
||||
int tries = 1;
|
||||
while (Glib::file_test (fileName, Glib::FILE_TEST_EXISTS) && tries<1000) {
|
||||
fileName = Glib::ustring::compose("%1-%2.%3", fname, tries, sf.format);
|
||||
tries++;
|
||||
}
|
||||
if (tries==1000){
|
||||
img->free ();
|
||||
return false;
|
||||
}
|
||||
|
||||
ProgressConnector<int> *ld = new ProgressConnector<int>();
|
||||
img->setSaveProgressListener (parent->getProgressListener());
|
||||
ld->startFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsTIFF), fileName, sf.tiffBits),
|
||||
ld->startFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsTIFF), fileName, sf.tiffBits, sf.tiffUncompressed),
|
||||
sigc::bind(sigc::mem_fun(*this,&EditorPanel::idle_sentToGimp), ld, img, fileName));
|
||||
}else{
|
||||
gdk_threads_enter();
|
||||
Glib::ustring msg_ = Glib::ustring("<b> Error during image processing\n</b>");
|
||||
Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
||||
msgd.run ();
|
||||
gdk_threads_leave ();
|
||||
gdk_threads_enter();
|
||||
Glib::ustring msg_ = Glib::ustring("<b> Error during image processing\n</b>");
|
||||
Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
|
||||
msgd.run ();
|
||||
gdk_threads_leave ();
|
||||
saveimgas->set_sensitive(true);
|
||||
sendtogimp->set_sensitive(true);
|
||||
}
|
||||
|
@@ -184,6 +184,7 @@ if (keyFile.has_group ("Output")) {
|
||||
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");
|
||||
if (keyFile.has_key ("Output", "TiffBps")) saveFormat.tiffBits = keyFile.get_integer ("Output", "TiffBps");
|
||||
if (keyFile.has_key ("Output", "TiffUncompressed")) saveFormat.tiffUncompressed= keyFile.get_boolean ("Output", "TiffUncompressed");
|
||||
if (keyFile.has_key ("Output", "SaveProcParams")) saveFormat.saveParams = keyFile.get_boolean ("Output", "SaveProcParams");
|
||||
if (keyFile.has_key ("Output", "Path")) savePathTemplate = keyFile.get_string ("Output", "Path");
|
||||
if (keyFile.has_key ("Output", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate");
|
||||
@@ -339,6 +340,7 @@ int Options::saveToFile (Glib::ustring fname) {
|
||||
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);
|
||||
keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams);
|
||||
keyFile.set_string ("Output", "PathTemplate", savePathTemplate);
|
||||
keyFile.set_string ("Output", "PathFolder", savePathFolder);
|
||||
|
@@ -28,6 +28,8 @@ SaveFormatPanel::SaveFormatPanel () : listener (NULL) {
|
||||
pngcompr = new Adjuster (M("SAVEDLG_PNGCOMPR"), 0, 6, 1, 6);
|
||||
pngcompr->setAdjusterListener (this);
|
||||
pngcompr->show ();
|
||||
tiffuncompressed = Gtk::manage (new Gtk::CheckButton (M("SAVEDLG_TIFFUNCOMPRESSED")));
|
||||
tiffuncompressed->show();
|
||||
|
||||
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
|
||||
Gtk::Label* flab = Gtk::manage (new Gtk::Label (M("SAVEDLG_FILEFORMAT")+":"));
|
||||
@@ -80,6 +82,7 @@ void SaveFormatPanel::init (SaveFormat &sf) {
|
||||
pngcompr->setValue (sf.pngCompression);
|
||||
jpegqual->setValue (sf.jpegQuality);
|
||||
savespp->set_active (sf.saveParams);
|
||||
tiffuncompressed->set_active (sf.tiffUncompressed);
|
||||
listener = tmp;
|
||||
}
|
||||
|
||||
@@ -99,6 +102,7 @@ SaveFormat SaveFormatPanel::getFormat () {
|
||||
sf.tiffBits = 8;
|
||||
sf.pngCompression = (int) pngcompr->getValue ();
|
||||
sf.jpegQuality = (int) jpegqual->getValue ();
|
||||
sf.tiffUncompressed = tiffuncompressed->get_active();
|
||||
sf.saveParams = savespp->get_active ();
|
||||
return sf;
|
||||
}
|
||||
@@ -109,6 +113,8 @@ void SaveFormatPanel::formatChanged () {
|
||||
removeIfThere (formatopts, jpegqual);
|
||||
else if (oformat==3 || oformat==4)
|
||||
removeIfThere (formatopts, pngcompr);
|
||||
else if (oformat==1 || oformat==2)
|
||||
removeIfThere (formatopts, tiffuncompressed);
|
||||
|
||||
int act = format->get_active_row_number();
|
||||
if (act<0 || act>4)
|
||||
@@ -119,6 +125,8 @@ void SaveFormatPanel::formatChanged () {
|
||||
formatopts->pack_start (*jpegqual, Gtk::PACK_SHRINK,4);
|
||||
else if (fr=="png")
|
||||
formatopts->pack_start (*pngcompr, Gtk::PACK_SHRINK,4);
|
||||
else if (fr=="tif")
|
||||
formatopts->pack_start (*tiffuncompressed, Gtk::PACK_SHRINK,4);
|
||||
|
||||
oformat = act;
|
||||
|
||||
|
@@ -35,6 +35,7 @@ class SaveFormatPanel : public Gtk::VBox, public AdjusterListener {
|
||||
protected:
|
||||
Adjuster* jpegqual;
|
||||
Adjuster* pngcompr;
|
||||
Gtk::CheckButton* tiffuncompressed;
|
||||
Gtk::ComboBoxText* format;
|
||||
Gtk::VBox* formatopts;
|
||||
int oformat;
|
||||
|
Reference in New Issue
Block a user