Bug 121370 - Can't save images sometimes after some modifications
Summary: Can't save images sometimes after some modifications
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: ImageEditor-Save (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-04 18:03 UTC by krienke
Modified: 2022-02-02 16:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description krienke 2006-02-04 18:03:19 UTC
Version:           0.9 (using KDE KDE 3.5.0)
Installed from:    SuSE RPMs
Compiler:          gcc 4 
OS:                Linux

In digikam 0.9 Revision 505718 after some image modifications its not possible  to save the image. I get an error dialog "Faild to save image <name> to folder <foldername>".

I saw this after applying Fix->Colors->Autocorrection->Normalize.

Other modifications like fliping the photo will not lead to this problem. The same photo can be saved then.
Comment 1 caulier.gilles 2006-02-04 18:15:51 UTC
Give me more informations to start digiKam from a console.

Note : I cannot accept any bug report about 0.9.0 alpha because the code is under development !!!

Gilles Caulier
Comment 2 caulier.gilles 2006-02-04 21:17:55 UTC
Give me a copy of your original image to test on my computer (put it on the web to download)

Witch kde/qt release you use ?

Gilles
Comment 3 krienke 2006-02-05 10:50:36 UTC
Am Samstag, 4. Februar 2006 21:17 schrieb Gilles Caulier:
[bugs.kde.org quoted mail]

KDE 3.5.0-29 (SuSE-RPMS on suse10.0)
qt  3.3.5-22 (      "     )

Rainer
Comment 4 krienke 2006-02-05 10:53:47 UTC
Am Samstag, 4. Februar 2006 21:17 schrieb Gilles Caulier:
[bugs.kde.org quoted mail]

Sorry forgot the link to the photo....

http://www.uni-koblenz.de/~krienke/tmp/dsc_0877.jpg

Have a nice day
Rainer
Comment 5 krienke 2006-02-07 09:27:56 UTC
In between I did an upgrade from KDE 3.5.0 to 3.5.1. The bug is still there so it does not seem to depend on the KDE version.

Rainer
Comment 6 F.J. Cruz 2006-02-07 17:06:30 UTC
El S
Comment 7 Mikolaj Machowski 2006-02-07 17:32:31 UTC
Have the same problem in trunk. After core mods (not digikamimageplugins) images are saved, after others - not.

----------------------------------------------------
Harry Potter i Ksi
Comment 8 krienke 2006-02-08 09:20:41 UTC
Yes "save as" does work whereas a simple "save" does not.

But for me it happens every time I apply the Autocorrection->Normalize filter but it happened never when I tried to flip the photo. So there seems to be some kind of dependency on the tool beeing used. It does not look like random behaviour.

Rainer
Comment 9 Marcel Wiesweg 2006-02-09 21:03:39 UTC
SVN commit 507673 by mwiesweg:

First part of the fix for 121370, only curing symptoms

- try harder finding a mimetype in DImgInterface
- remove const char usage, use QString (not part of the fix)

CCBUG: 121370


 M  +7 -5      libs/dimg/dimg.cpp  
 M  +1 -1      libs/dimg/dimg.h  
 M  +1 -1      libs/threadimageio/loadsavetask.cpp  
 M  +16 -6     utilities/imageeditor/canvas/dimginterface.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/dimg.cpp #507672:507673
@@ -238,14 +238,16 @@
     return false;
 }
 
-bool DImg::save(const QString& filePath, const char* format, DImgLoaderObserver *observer)
+bool DImg::save(const QString& filePath, const QString& format, DImgLoaderObserver *observer)
 {
     if (isNull())
         return false;
-    
-    QString frm = QString::fromLatin1(format);
-    frm = frm.upper();
-    
+
+    if (format.isEmpty())
+        return false;
+
+    QString frm = format.upper();
+
     if (frm == "JPEG" || frm == "JPG")
     {
         JPEGLoader loader(this);
--- trunk/extragear/graphics/digikam/libs/dimg/dimg.h #507672:507673
@@ -109,7 +109,7 @@
     bool        load(const QString& filePath, DImgLoaderObserver *observer = 0,
                      RawDecodingSettings rawDecodingSettings=RawDecodingSettings());
                      
-    bool        save(const QString& filePath, const char* format, DImgLoaderObserver *observer = 0);
+    bool        save(const QString& filePath, const QString& format, DImgLoaderObserver *observer = 0);
 
     bool        isNull()     const;
     uint        width()      const;
--- trunk/extragear/graphics/digikam/libs/threadimageio/loadsavetask.cpp #507672:507673
@@ -325,7 +325,7 @@
 
 void SavingTask::execute()
 {
-    bool success = m_img.save(m_filePath, m_format.ascii(), this);
+    bool success = m_img.save(m_filePath, m_format, this);
     m_thread->taskHasFinished();
     QApplication::postEvent(m_thread, new SavedEvent(m_filePath, success));
 };
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/dimginterface.cpp #507672:507673
@@ -433,7 +433,7 @@
 }
 
 void DImgInterface::saveAs(const QString& file, IOFileSettingsContainer *iofileSettings, 
-                           const QString& mimeType)
+                           const QString& givenMimeType)
 {
     d->cmod.reset();
     d->cmod.setGamma(d->gamma);
@@ -443,17 +443,27 @@
 
     d->needClearUndoManager = false;
 
+    // Try hard to find a mimetype.
+    QString mimeType = givenMimeType;
+    // This is possibly empty
     if (mimeType.isEmpty())
-        saveAction(file, iofileSettings, d->image.attribute("format").toString());
-    else
-        saveAction(file, iofileSettings, mimeType);
+    {
+        mimeType = d->image.attribute("format").toString();
+        // It is a bug if format attribute is not given
+        if (mimeType.isEmpty())
+        {
+            kdWarning() << "DImg object does not contain attribute \"format\"" << endl;
+            mimeType = QImageIO::imageFormat(d->filename);
+        }
+    }
+    saveAction(file, iofileSettings, mimeType);
 }
 
 void DImgInterface::saveAction(const QString& fileName, IOFileSettingsContainer *iofileSettings,
                                const QString& mimeType) 
 {
     kdDebug() << "Saving to :" << QFile::encodeName(fileName).data() << " (" 
-              << mimeType.ascii() << ")" << endl;
+              << mimeType << ")" << endl;
 
     if ( mimeType.upper() == QString("JPG") || mimeType.upper() == QString("JPEG") ) 
        d->image.setAttribute("quality", iofileSettings->JPEGCompression);
@@ -465,7 +475,7 @@
        d->image.setAttribute("compress", iofileSettings->TIFFCompression);
 
     d->savingFilename = fileName;
-    d->thread->save(d->image, fileName, mimeType.ascii());
+    d->thread->save(d->image, fileName, mimeType);
 }
 
 void DImgInterface::slotImageSaved(const QString& filePath, bool success)
Comment 10 krienke 2006-02-10 11:17:57 UTC
Now saving the image works again, but after it has been saved all the EXIF infos are lost.  

Rainer
Comment 11 Marcel Wiesweg 2006-02-13 19:21:15 UTC
Commits 508640 and 508653 should have fixed this. Now metadata is always preserved in DImg.