Commit Graph

38 Commits

Author SHA1 Message Date
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Michael Natterer d66b845bac libgimpbase: capitalize some docs section titles 2019-08-01 12:48:41 +02:00
Jehan ab6783902e libgimpbase: more (transfer) and (element-type) warnings fixed. 2019-07-28 10:09:46 +02:00
luz.paz 86edc31b11 Misc. typos
Found via `codespell`
2019-05-09 09:13:37 -04:00
Michael Natterer 479fd5b24b libgimpbase: more metadata fixes for tags that can appear multiple times
gimp_metadata_add() which is used to set blobs or EXIF, XMP and IPTC
on a GimpMetadata also needs the logic to set "multiple" tags in one
go, or it will lose all but the first one.
2019-01-07 21:38:12 +01:00
Michael Natterer d708ac0b21 Issue #1437 - 2.10 Image Metadata "keywords" corrupt
We were not taking into account tags that can appear multiple times,
such as "keyword", they are handled by gexiv2 with the
get_tag_multiple() and set_tag_multiple() functions.

gimp_metadata_deserialize_text(): when deserializing our XML format,
check if a tag is already set on the metadata as "multiple" and if yes
retrieve it, append the new value and set it again.

gimp_image_metadata_save_finish(): take care of "multiple" values when
copying tags to new metadata created for saving.

This should preserve all values across an "import, edit, export".

Thing will still break when using the metadata editor, it doesn't
handle multiple values at all, but that code is very hard to
understand.
2019-01-06 17:52:19 +01:00
Michael Natterer 8421221b60 Issue #2388 - CRITICAL: XMP Toolkit error 4: Invalid UTF-8 data byte
In gimp_metadata_add_xmp_history(), make sure the string returned by
strftime() has a terminating \0 after we mess with its format.
2018-10-22 15:48:26 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Ell eafefc7d81 libgimpbase: gracefully reject Exif/IPTC/XMP metadata of invalid size
In gimp_metadata_set_from_{exif,iptc,xmp}(), gracefully reject data
of invalid size, returning an error instead of raising a critical.

In particular, this avoids a CRITICAL when loading an XCF with an
empty exif-ata parasite.
2018-07-05 22:47:45 -04:00
Michael Natterer f4f106ad26 libimp*: add private pointers to all instance structs
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
2018-05-20 21:06:33 +02:00
Jehan 070bcb8979 libgimpbase: strengthen other use of g_win32_locale_filename_from_utf8()
Let's make our various usages of this broken function more robust, or at
least return with errors when we can. But this is still seriously
broken. Inside gimp_locale_directory() though, there was nothing I could
do, so I just added a FIXME for at least keeping an eye on it.
2018-04-30 22:23:18 +02:00
Michael Natterer b0b381b6c8 libgimp*: don't say "2.9" in metadata 2018-04-26 16:06:32 +02:00
Jehan ba06a0fe86 Bug 794949 - Plugin crash when opening png, jpeg or tiff with...
... non-latin unicode path.
g_win32_locale_filename_from_utf8() was sometimes returning NULL for
some paths on Windows. Then the call to gexiv2_metadata_open_path() with
a NULL value was crashing plug-ins.
This commit only prevents from crashing by simply failing to load
metadata when this occurs, which means losing metadata support on
Windows depending on filenames. A proper solution will have to be
implemented.
2018-04-05 00:18:28 +02:00
Massimo Valentini 4645a98915 Bug 792352: No namespace info available for XMP prefix `darktable'
Also avoids creating a Gexiv2Metadata object leaked every time
gimp_metadata_new() is called.
2018-01-09 16:17:28 +01:00
Michael Natterer e2ddfdc391 libgimpbase: add #define GIMP_METADATA_ERROR gimp_metadata_error_quark () 2017-09-03 15:46:17 +02:00
Mikael Magnusson cab45eebf0 libgimpbase: fix compilation error in gimpmetadata.c 2017-08-11 19:42:18 +02:00
Michael Natterer 3b1916654c libgimpbase: return a \0 terminated string from gimp_metadata_get_guid() 2017-07-17 08:20:46 +02:00
Michael Natterer 93d2f49c16 Bug 784961 - Undeclared identifier 'TIME_UTC' - GIMP fails to build...
...on macOS (with macports)

Changed gimp_metadata_get_guid() to use a GRand that automatically
seeds itself from /dev/urandom (if available) or the current time.
2017-07-16 14:01:18 +02:00
Michael Natterer 747b3768ef libgimpbase: remove gimp_metadata_register_xmp_namespace[s]()
and do the same in gimp_metadata_class_init(). Also fix all compiler
warnings and other stuff.
2017-07-07 19:11:12 +02:00
Ben Touchette dc9856cfe1 Bug 769820 - Cannot enter Iptc information when no metadata is available...
...and fails to write it to file when it is

Completely redo metadata editor and viewer code, adds support for
Xmp.xmpMM.History and more.
2017-07-07 18:11:39 +02:00
Simon Budig 0d073b943c libgimpbase: make the private data size > 0 to avoid critical warnings 2017-01-30 17:05:23 +01:00
Simon Budig 884edf56ca libgimpbase: make GimpMetadata its own type derived from GExiv2Metadata 2017-01-30 16:43:59 +01:00
Hartmut Kuhse 66bc98d299 Revert "New GimpMetadata as subclass of GExiv2Metadata"
This reverts commit 3ab08c8bfd.
2017-01-03 19:36:22 +01:00
Hartmut Kuhse 3ab08c8bfd New GimpMetadata as subclass of GExiv2Metadata 2017-01-03 19:26:35 +01:00
Michael Natterer e5a669bdfc libgimpbase: fix gimp_metadata_set_from_xmp() to really expect XMP
Don't skip the first 10 bytes. That code was there to skip the magic
"GIMP_XMP_1" of the old "gimp-metadata" parasite. Instead, properly
check for that magic in xcf_load_image() and pass only the actual XMP
to gimp_metadata_set_from_xmp(). Also remove the +10 hack in file-exr.
2016-04-22 22:49:06 +02:00
Massimo Valentini a3f4c50b3e Bug 765411: CRITICAL warnings loading an xcf with...
"exif-data" parasite

To migrate old "exif-data" parasites to GimpMetadata
an exif-only jpeg file is generated in memory, but its
APP1 marker length was 2 bytes short resulting in a
CRITICAL warning:

** (gimp-2.9:9): CRITICAL **: Directory Photo: IFD exceeds data buffer, cannot read next pointer.

Properly terminating the jpeg with an EOI marker also
gets rid of the WARNING:

** (gimp-2.9:9): WARNING **: JPEG format error, rc = 5
2016-04-22 17:30:44 +02:00
Michael Natterer 6c20609f96 Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Change the logic in gimp_metadata_get_colorspace() to be like in the
respective KExiv2 function, which looks pretty well done. No guarantee
of correctness, this just looks more logical than before :)
2015-10-06 21:32:12 +02:00
Michael Natterer 15b7b17b12 Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Some refactoring: add gimp_metadata_get,set_colorspace() and a new
enum GimpMetadataColorspace which so far can be one of { UNSPECIFIED,
UNCALIBRATED, SRGB, ADOBERGB }. The setter is untested and I don't
know if it's doing the right thing, please review. Use the getter in
gimp_image_metadata_load_finish(), so complex metadata logic and
profile creation/setting are separated.
2015-09-30 20:51:40 +02:00
Michael Natterer 8005eea835 Remove the "GIMP" from all "Since: GIMP 2.x" API doc comments
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2015-05-31 21:18:09 +02:00
Michael Natterer 24da0007a4 libgimp*: some API doc fixes 2015-05-31 14:40:20 +02:00
Michael Natterer 33a8d68117 Bug 711241 - Broken or unknown metadata tag should not cancel...
...the whole metadata loading

Don't drop non-utf8 values from gexiv2 when serializing to XML,
instead, base64 encode them. This should be robust against whatever
garbage data is in tags.
2013-11-11 00:11:43 +01:00
Michael Natterer ce57aef6ee libgimpbase: fix gimp_metadata_set_resolution() to only set rationals
Rationals have integers as nominator and denominator, so we can't set
something like "300.5/1". Instead, multiply the nominator and
denominator of non-integer ppi values until the error is smaller than
0.01, or the denomiator reaches 100 ("300.5/1" becomes "601/2").
2013-11-01 17:36:26 +01:00
Michael Natterer e03fd943bf libgimpbase: use gexiv2_metadata_get_exif_tag_rational() to get the resolution
and remove our own rational parser, we can get it back from git if we
need it again.
2013-11-01 17:01:44 +01:00
Michael Natterer 798c62a544 Bug 711241 - Broken or unknown metadata tag should not cancel...
...the whole metadata loading

Don't serialize a value that does not UTF-8-validate to XML. This is
not a real fix, but no matter what we do here in the future, UTF-8
validation should always be part of the serialization, in order to
avoid passing broken data into the core.
2013-11-01 14:15:15 +01:00
Michael Schumacher 8db3b4312d Global EXIF -> Exif string change (official spelling) 2013-10-29 22:48:46 +01:00
Michael Natterer 573a8513a5 libgimpbase: add API docs to libgimpbase/gimpmetadata.c 2013-10-27 21:13:51 +01:00
Michael Natterer 0b8e59c84e libgimpbase: fix typos in gimpmetadata.c 2013-10-27 16:32:26 +01:00
Hartmut Kuhse 21bed1e2fb Completely rewrite metadata handling using gexiv2
Based on original patches from Hartmut Kuhse and modified
by Michael Natterer. Changes include:

- remove libexif dependency and add a hard dependency on gexiv2
- typedef GExiv2Metadata to GimpMetadata to avoid having to
  include gexiv2 globally
- add basic GimpMetadata handling functions to libgimpbase
- add image and image file specific metadata functions to libgimp,
  including the exif orientation image rotate dialog
- port plug-ins to use the new APIs
- port file-tiff-save's UI to GtkBuilder
- add new plug-in "metadata" to view the image's metadata
- keep metadata around as GimpImage member in the core
- update the image's metadata on image size, resolution and precision
  changes
- obsolete the old metadata parasites
- migrate the old parasites to new GimpMetadata object on XCF load
2013-10-27 01:02:17 +02:00