aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libpyexiv2.cpp22
-rw-r--r--src/libpyexiv2.hpp5
-rw-r--r--src/libpyexiv2_wrapper.cpp1
-rw-r--r--src/todo3
4 files changed, 30 insertions, 1 deletions
diff --git a/src/libpyexiv2.cpp b/src/libpyexiv2.cpp
index 389f2c1..2c8fb4d 100644
--- a/src/libpyexiv2.cpp
+++ b/src/libpyexiv2.cpp
@@ -493,4 +493,26 @@ namespace LibPyExiv2
}
}
+ bool Image::setThumbnailFromJpegFile(const std::string path)
+ {
+ if(_dataRead)
+ {
+ try
+ {
+ _exifData.setJpegThumbnail(path);
+ return true;
+ }
+ catch(Exiv2::Error& e)
+ {
+ std::cerr << ">>> Image::setThumbnailFromJpegFile(): caught Exiv2 exception '" << e << "'";
+ return false;
+ }
+ }
+ else
+ {
+ std::cerr << ">>> Image::setThumbnailFromJpegFile(): metadata not read yet, call Image::readMetadata() first" << std::endl;
+ return false;
+ }
+ }
+
} // End of namespace LibPyExiv2
diff --git a/src/libpyexiv2.hpp b/src/libpyexiv2.hpp
index 217da50..a4bb735 100644
--- a/src/libpyexiv2.hpp
+++ b/src/libpyexiv2.hpp
@@ -119,6 +119,11 @@ namespace LibPyExiv2
// Returns true if successful, false otherwise.
bool dumpThumbnailToFile(const std::string path);
+ // Sets the image contained in the jpeg file passed as a parameter as
+ // the thumbnail of the image.
+ // Returns true if successful, false otherwise.
+ bool setThumbnailFromJpegFile(const std::string path);
+
private:
std::string _filename;
Exiv2::Image::AutoPtr _image;
diff --git a/src/libpyexiv2_wrapper.cpp b/src/libpyexiv2_wrapper.cpp
index 7e00760..a84cd11 100644
--- a/src/libpyexiv2_wrapper.cpp
+++ b/src/libpyexiv2_wrapper.cpp
@@ -52,5 +52,6 @@ BOOST_PYTHON_MODULE(libpyexiv2)
.def("setThumbnailData", &Image::setThumbnailData)
.def("deleteThumbnail", &Image::deleteThumbnail)
.def("dumpThumbnailToFile", &Image::dumpThumbnailToFile)
+ .def("setThumbnailFromJpegFile", &Image::setThumbnailFromJpegFile)
;
}
diff --git a/src/todo b/src/todo
index 52bda27..0ea0952 100644
--- a/src/todo
+++ b/src/todo
@@ -1,5 +1,6 @@
todo list
-- Add support for thumbnail extraction
- Add extensive unit tests
- Document the binding
+- Provide examples on how to use the thumbnail extraction features with pygtk
+ and pyqt