kolesa-team / goexiv Goto Github PK
View Code? Open in Web Editor NEWGo bindings for the exiv2 library. Allows reading and writing EXIF/IPTC metadata to/from JPG, WEBP and PNG images.
License: MIT License
Go bindings for the exiv2 library. Allows reading and writing EXIF/IPTC metadata to/from JPG, WEBP and PNG images.
License: MIT License
When I read a jpg file and get it iptc metadata with the key "Iptc.Application2.Keywords"
It should be a stringlist or at least "a,b,c...,y,z"
but I only get "z"
Hello,
With exiv2 0.28.0
I encountered an issue while trying to compile the goexiv library. I am receiving numerous errors related to the helper.cpp file. I'm not familiar with C++, but if the error is not too complex and some guidance can be provided, I am willing to attempt a PR to fix the issue. Below are the errors I am encountering:
helper.cpp:22:50: error: expected ‘)’ before ‘image’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~
helper.cpp:10:30: note: in definition of macro ‘DEFINE_STRUCT’
10 | _##name(wrapped_type member_name) \
| ^~~~~~~~~~~
helper.cpp:10:16: note: to match this ‘(’
10 | _##name(wrapped_type member_name) \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:22:41: error: ‘AutoPtr’ in ‘class Exiv2::Image’ does not name a type
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~
helper.cpp:12:9: note: in definition of macro ‘DEFINE_STRUCT’
12 | wrapped_type member_name; \
| ^~~~~~~~~~~~
helper.cpp: In constructor ‘_Exiv2Error::_Exiv2Error(const Exiv2::Error&)’:
helper.cpp:60:26: error: cannot convert ‘Exiv2::ErrorCode’ to ‘int’ in initialization
60 | : code(error.code())
| ~~~~~~~~~~^~
| |
| Exiv2::ErrorCode
helper.cpp: In function ‘Exiv2Image* exiv2_image_factory_open(const char*, Exiv2Error**)’:
helper.cpp:71:67: error: no matching function for call to ‘_Exiv2Image::_Exiv2Image(Exiv2::Image::UniquePtr)’
71 | p = new Exiv2Image(Exiv2::ImageFactory::open(path));
| ^
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image()’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate expects 0 arguments, 1 provided
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(const _Exiv2Image&)’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘const _Exiv2Image&’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(_Exiv2Image&&)’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘_Exiv2Image&&’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp: In function ‘Exiv2Image* exiv2_image_factory_open_bytes(const unsigned char*, long int, Exiv2Error**)’:
helper.cpp:90:74: error: no matching function for call to ‘_Exiv2Image::_Exiv2Image(Exiv2::Image::UniquePtr)’
90 | p = new Exiv2Image(Exiv2::ImageFactory::open(bytes, size));
| ^
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image()’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate expects 0 arguments, 1 provided
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(const _Exiv2Image&)’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘const _Exiv2Image&’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(_Exiv2Image&&)’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp:9:8: note: no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘_Exiv2Image&&’
9 | struct _##name { \
| ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
| ^~~~~~~~~~~~~
helper.cpp: In function ‘void exiv2_image_read_metadata(Exiv2Image*, Exiv2Error**)’:
helper.cpp:107:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
107 | img->image->readMetadata();
| ^~~~~
helper.cpp: In function ‘void exiv2_image_set_exif_string(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:118:41: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
118 | Exiv2::ExifData exifData = img->image->exifData();
| ^~~~~
helper.cpp:122:31: error: ‘AutoPtr’ is not a member of ‘Exiv2::Value’
122 | Exiv2::Value::AutoPtr valueObject = Exiv2::Value::create(Exiv2::asciiString);
| ^~~~~~~
helper.cpp:123:17: error: ‘valueObject’ was not declared in this scope
123 | valueObject->read(value);
| ^~~~~~~~~~~
helper.cpp:126:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
126 | img->image->setExifData(exifData);
| ^~~~~
helper.cpp:127:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
127 | img->image->writeMetadata();
| ^~~~~
helper.cpp: In function ‘void exiv2_image_set_exif_short(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:138:41: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
138 | Exiv2::ExifData exifData = img->image->exifData();
| ^~~~~
helper.cpp:142:31: error: ‘AutoPtr’ is not a member of ‘Exiv2::Value’
142 | Exiv2::Value::AutoPtr valueObject = Exiv2::Value::create(Exiv2::unsignedShort);
| ^~~~~~~
helper.cpp:143:17: error: ‘valueObject’ was not declared in this scope
143 | valueObject->read(value);
| ^~~~~~~~~~~
helper.cpp:146:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
146 | img->image->setExifData(exifData);
| ^~~~~
helper.cpp:147:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
147 | img->image->writeMetadata();
| ^~~~~
helper.cpp: In function ‘void exiv2_image_set_iptc_string(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:158:41: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
158 | Exiv2::IptcData iptcData = img->image->iptcData();
| ^~~~~
helper.cpp:165:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
165 | img->image->setIptcData(iptcData);
| ^~~~~
helper.cpp:166:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
166 | img->image->writeMetadata();
| ^~~~~
helper.cpp: In function ‘void exiv2_image_set_iptc_short(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:177:37: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
177 | Exiv2::IptcData iptcData = img->image->iptcData();
| ^~~~~
helper.cpp:181:23: error: ‘AutoPtr’ is not a member of ‘Exiv2::Value’
181 | Exiv2::Value::AutoPtr valueObject = Exiv2::Value::create(Exiv2::unsignedShort);
| ^~~~~~~
helper.cpp:182:9: error: ‘valueObject’ was not declared in this scope
182 | valueObject->read(value);
| ^~~~~~~~~~~
helper.cpp:185:14: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
185 | img->image->setIptcData(iptcData);
| ^~~~~
helper.cpp:186:14: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
186 | img->image->writeMetadata();
| ^~~~~
helper.cpp: In function ‘long int exiv_image_get_size(Exiv2Image*)’:
helper.cpp:197:23: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
197 | return (long)img->image->io().size();
| ^~~~~
helper.cpp: In function ‘unsigned char* exiv_image_get_bytes_ptr(Exiv2Image*)’:
helper.cpp:203:17: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
203 | return img->image->io().mmap();
| ^~~~~
helper.cpp: In function ‘int exiv2_image_get_pixel_width(Exiv2Image*)’:
helper.cpp:210:21: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
210 | return img->image->pixelWidth();
| ^~~~~
helper.cpp: In function ‘int exiv2_image_get_pixel_height(Exiv2Image*)’:
helper.cpp:214:21: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
214 | return img->image->pixelHeight();
| ^~~~~
helper.cpp: In function ‘const unsigned char* exiv2_image_icc_profile(Exiv2Image*)’:
helper.cpp:219:18: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
219 | if (img->image->iccProfileDefined()) {
| ^~~~~
helper.cpp:220:29: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
220 | return img->image->iccProfile()->pData_;
| ^~~~~
helper.cpp: In function ‘long int exiv2_image_icc_profile_size(Exiv2Image*)’:
helper.cpp:227:18: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
227 | if (img->image->iccProfileDefined()) {
| ^~~~~
helper.cpp:228:29: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
228 | return img->image->iccProfile()->size_;
| ^~~~~
helper.cpp: In function ‘Exiv2XmpData* exiv2_image_get_xmp_data(const Exiv2Image*)’:
helper.cpp:237:38: error: ‘const Exiv2Image’ {aka ‘const struct _Exiv2Image’} has no member named ‘image’
237 | return new Exiv2XmpData(img->image->xmpData());
| ^~~~~
helper.cpp: In function ‘Exiv2IptcData* exiv2_image_get_iptc_data(const Exiv2Image*)’:
helper.cpp:284:39: error: ‘const Exiv2Image’ {aka ‘const struct _Exiv2Image’} has no member named ‘image’
284 | return new Exiv2IptcData(img->image->iptcData());
| ^~~~~
helper.cpp: In function ‘Exiv2ExifData* exiv2_image_get_exif_data(const Exiv2Image*)’:
helper.cpp:354:39: error: ‘const Exiv2Image’ {aka ‘const struct _Exiv2Image’} has no member named ‘image’
354 | return new Exiv2ExifData(img->image->exifData());
| ^~~~~
Please let me know if you have any suggestions or guidance on how to approach this issue, and if there are any additional details needed.
Thank you!
Short values related to IPTC cannot be written
Iptc.Application2.RecordVersion
Iptc.Envelope.ModelVersion
etc
// Does not result in an error
err :=rimg.SetIptcString(v.Key, v.Value)
if err != nil {
dlog.Println(err.Error())
return
}
I was able to write a character string
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.