Summary: | jpeg meta info comment lost on editing in krita | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | Thomas Zander <zander> |
Component: | General | Assignee: | Bart Coppens <kde> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Thomas Zander
2005-09-16 14:10:29 UTC
Okay... I'm not even sure that ImageMagick loads those fields, but if it does, it should be doable to keep that. I'll assign this bug to Bart because he did such a sterling job with the other annotations. SVN commit 461107 by coppens: Also import and export imagemagick's so-called "attributes". This includes saving of user comments to file. Should work on all imagemagick versions, but it wouldn't surprise me if there were some weird version that depends on those ImageAttributeIterator calls that are in the online docs but not in my install. If you find such a version, file a bug report for it. BUG: 112723 M +35 -4 kis_image_magick_converter.cc --- trunk/koffice/filters/krita/magick/kis_image_magick_converter.cc #461106:461107 @@ -161,6 +161,7 @@ const StringInfo *profile; KisAnnotation* annotation = 0; + // Profiles and so ResetImageProfileIterator(src); while((name = GetNextImageProfile(src))) { profile = GetImageProfile(src, name); @@ -180,6 +181,26 @@ image -> addAnnotation(annotation); } + + // Attributes, since we have no hint on if this is an attribute or a profile + // annotation, we prefix it with 'krita_attribute:'. XXX This needs to be rethought! + // And there are apparantly attribute iterator functions like above, but not + // in my magick version *sigh* + ImageAttribute * attr = src -> attributes; + while (attr) { + QByteArray rawdata; + int len = strlen(attr -> value) + 1; + rawdata.resize(len); + memcpy(rawdata.data(), attr -> value, len); + + annotation = new KisAnnotation( + QString("krita_attribute:%1").arg(QString(attr -> key)), "", rawdata); + Q_CHECK_PTR(annotation); + + image -> addAnnotation(annotation); + attr = attr -> next; + } + #endif } @@ -194,11 +215,21 @@ ++it; continue; } + kdDebug() << "Trying to store annotation of type " << (*it) -> type() << " of size " << (*it) -> annotation() . size() << endl; - if (!ProfileImage(dst, (*it) -> type().ascii(), - (unsigned char*)(*it) -> annotation() . data(), - (*it) -> annotation() . size(), MagickFalse)) { - kdDebug() << "Storing failed!" << endl; + + if ((*it) -> type().startsWith("krita_attribute:")) { // Attribute + if (!SetImageAttribute(dst, + (*it) -> type().mid(strlen("krita_attribute:")).ascii(), + (*it) -> annotation() . data()) ) { + kdDebug() << "Storing of attribute " << (*it) -> type() << "failed!\n"; + } + } else { // Profile + if (!ProfileImage(dst, (*it) -> type().ascii(), + (unsigned char*)(*it) -> annotation() . data(), + (*it) -> annotation() . size(), MagickFalse)) { + kdDebug() << "Storing failed!" << endl; + } } ++it; } |