aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2007-01-03 23:01:30 +0100
committerOlivier Tilloy <olivier@tilloy.net>2007-01-03 23:01:30 +0100
commit35bf3a8dcc8812a9956108f9b401f478cadc60f7 (patch)
treee731a603b2d2e7e47a54c6ddd1ae12732c5d3d61 /src
parent3eb675871bec989b3027622f6d615140daf76d41 (diff)
downloadpyexiv2-35bf3a8dcc8812a9956108f9b401f478cadc60f7.tar.gz
Implemented Image::setThumbnailData() that sets the thumbnail embedded in an image from raw jpeg data.
Diffstat (limited to 'src')
-rw-r--r--src/libpyexiv2.cpp17
-rw-r--r--src/libpyexiv2.hpp7
2 files changed, 16 insertions, 8 deletions
diff --git a/src/libpyexiv2.cpp b/src/libpyexiv2.cpp
index 79e8959..76c06ed 100644
--- a/src/libpyexiv2.cpp
+++ b/src/libpyexiv2.cpp
@@ -23,7 +23,7 @@
Author(s): Olivier Tilloy <olivier@tilloy.net>
History: 28-Dec-06, Olivier Tilloy: created
30-Dec-06, Olivier Tilloy: implemented IPTC-related methods
- 03-Jan-07, Olivier Tilloy: implemented getThumbnailData()
+ 03-Jan-07, Olivier Tilloy: implemented thumbnail-related methods
*/
// *****************************************************************************
@@ -434,10 +434,19 @@ namespace LibPyExiv2
}
}
- bool Image::setThumbnailData(boost::python::tuple data)
+ bool Image::setThumbnailData(std::string data)
{
- //TODO
- return true;
+ if(_dataRead)
+ {
+ const Exiv2::byte* dataBuf = (const Exiv2::byte*) data.c_str();
+ _exifData.setJpegThumbnail(dataBuf, data.size());
+ return true;
+ }
+ else
+ {
+ std::cerr << ">>> Image::setThumbnailData(): 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 61f46b4..91956cc 100644
--- a/src/libpyexiv2.hpp
+++ b/src/libpyexiv2.hpp
@@ -104,11 +104,10 @@ namespace LibPyExiv2
// "JPEG") and the thumbnail raw data as a string buffer.
boost::python::tuple getThumbnailData();
- // Sets the thumbnail of the image. The first element of the tuple is
- // the format of the thumbnail ("TIFF" or "JPEG") and the second element
- // is the thumbnail raw data as a string buffer.
+ // Sets the thumbnail of the image. The parameter is the thumbnail raw
+ // jpeg data as a string buffer.
// Returns true if successful, false otherwise.
- bool setThumbnailData(boost::python::tuple data);
+ bool setThumbnailData(std::string data);
private:
std::string _filename;