Commit Graph

45 Commits

Author SHA1 Message Date
John Cupitt b8a2d26ad9 Merge branch '8.13' 2022-11-09 14:53:43 +00:00
Lovell Fuller c76d74be65
Ensure EXIF is at least 4 bytes before inspection (#3109) 2022-10-22 11:20:53 +01:00
John Cupitt 2335172794 Merge branch '8.13' 2022-10-19 12:47:53 +01:00
Lovell Fuller 1fc01c05e8
exif: ensure prefix is present before parsing (#3100)
Newer Apple devices are creating EXIF without this however libexif
still requires it due to JPEG/JFIF/APP1 marker heritage.
2022-10-19 12:47:23 +01:00
Kleis Auke Wolthuizen 3f95543c2c
Allow to modify/create EXIF GPS* tags (#2966)
* Allow to modify/create EXIF GPS* tags

Make `tag_is_ascii` aware of the EXIF GPS* ASCII tags that are
available since libexif 0.6.23.

See: https://github.com/lovell/sharp/issues/2767

* Add tests
2022-07-30 19:21:54 +01:00
Kleis Auke Wolthuizen 9cbc361269
Allow to modify/create EXIF OffsetTime* tags (#2796)
Available since libexif 0.6.23.
2022-05-10 13:26:09 +01:00
Kleis Auke Wolthuizen d91cfa4e53
Allow to modify/create EXIF 2.3 ASCII tags (#2795)
* Allow to modify/create EXIF 2.3 ASCII tags

Make `tag_is_ascii` aware of the EXIF 2.3 ASCII tags that are
available since libexif 0.6.22.

See: https://github.com/kleisauke/net-vips/issues/167

* Fix CI
2022-05-10 08:13:22 +01:00
John Cupitt 9713a71bf0 block resolutions < 0
since they can trigger a sanity failure in the test suite
2022-03-22 15:09:13 +00:00
Kleis Auke Wolthuizen 0337c09700
Cleanup gettext handling (#2695)
Use GLib's i18n support instead of copying and pasting that
logic into its own header. This deprecates the vips/intl.h
header in favour of glib/gi18n.h.
2022-02-27 15:27:28 +00:00
John Cupitt e0bb8e5d58 make exif resunit optional and default to inch
Some images don't set the exif resolution unit. We were ignoring exif
resolution in this case, but that's not correct, it's supposed to
default to inch.

See https://web.archive.org/web/20190624045241if_/http://www.cipa.jp:80/std/documents/e/DC-008-Translation-2019-E.pdf for the full spec.
2021-11-26 11:10:29 +00:00
John Cupitt ad295b5d41 add changelog notes 2021-11-13 14:36:38 +00:00
John Cupitt 8195b67d83 better exif string value change detection
see https://github.com/libvips/libvips/pull/2518
2021-11-09 19:28:55 +00:00
Lovell Fuller 117dbd888a Set minimum glib dependency version of 2.40 (March 2014) 2021-02-24 21:59:21 +00:00
John Cupitt ae82bcc3e8 fix out of bounds exif read in heifload
We were subtracting 4 from the length of the exif data block without
checking that there were 4 or more bytes there.
2020-10-20 08:54:54 +01:00
John Cupitt 63a549a3b2 Ugly hack to hide the GPSVersionID bug
see https://github.com/libvips/libvips/issues/394
2020-07-18 11:59:42 +01:00
Kleis Auke Wolthuizen 9246094033 Fix function pointer cast issues
It is undefined behavior in C and C++ to cast a function pointer
to another type and call it that way. This does work in most native
platforms, however, despite it being UB, but in WASM it can fail.

See:
https://emscripten.org/docs/porting/guidelines/function_pointer_issues.html
2020-06-30 13:35:41 +02:00
John Cupitt 981d5c4b16 revise autorot system
- deprecate vips_autorot_get_angle() since orientation is no longer a
simple rotate
- add vips_image_get_orientation() and vips_image_get_orientation_swap()
- revise tiff and jpeg loader autorotate to just call vips_autorot(),
but only if necessary
- revise thumbnail autorotate too
2020-06-06 17:25:46 +01:00
John Cupitt ffa10eb148 default JFIF res to 72dpi
We were 1ppm before. 72dpi is the EXIF default.
2020-05-13 14:34:59 +01:00
Andrii Dmytrenko 9609f4f1d7 Check if orientation is less than 1 2020-01-06 11:30:27 +00:00
Andrii Dmytrenko d0b69826cc Reset orientation if exif data is incorrect 2020-01-06 11:02:10 +00:00
John Cupitt 8c1377ebff Merge branch '8.8' 2019-08-25 11:30:14 +01:00
John Cupitt db6e6a0076 catch /0 in exif read 2019-08-25 11:29:37 +01:00
John Cupitt db49e82bda fix typo 2019-08-19 23:31:25 +01:00
John Cupitt 593b6f0d93 better /0 protection 2019-08-19 23:05:59 +01:00
John Cupitt b8a158b69b seems to work
added some more consts as well
2019-01-03 13:34:13 +00:00
John Cupitt cff4af34ca add vips_image_set_blob_copy()
and use it where we can
2018-11-23 16:27:39 +00:00
John Cupitt 0fea113bbf fix build on older glibs
we were using g_str_to_ascii(), but it was only added in glib 2.40

see https://github.com/libvips/libvips/issues/1117
2018-10-01 20:15:34 +01:00
John Cupitt 8891d6dc29 exif strings were not trimmed correctly
drop_tail() missed the final "()"
2018-08-28 11:08:49 +01:00
John Cupitt d06c2fee22 use exif_tag_get_name_in_ifd() everywhere
exif tag names change with the ids they appear in, so you must always
use exif_tag_get_name_in_ifd(), not exif_tag_get_name()

see: https://github.com/jcupitt/libvips/pull/1030
2018-07-09 09:35:39 +01:00
Water Liu bba03a10d7 Should use exif_tag_name_in_ifd() instead of exif_tag_get_name()
vipsheader -a path/to/foo.jpg
...
exif-ifd2-ExifVersion: Exif Version 2.21 (Exif Version 2.21, Undefined, 4 components, 4 bytes)
...
exif-ifd3-InteroperabilityIndex: N (N, ASCII, 2 components, 2 bytes)
exif-ifd3-InteroperabilityVersion: 40/1 1/1 58/100 (40,  1, 0.58, Rational, 3 components, 24 bytes)

The above two tag name are incorrect, should be:

exif-ifd3-GPSLatitudeRef: N (N, ASCII, 2 components, 2 bytes)
exif-ifd3-GPSLatitude: 40/1 1/1 58/100 (40,  1, 0.58, Rational, 3 components, 24 bytes)

Signed-off-by: Water Liu <water@yunify.com>
2018-07-09 11:14:12 +08:00
John Cupitt f0a44ce936 add a few more string types 2018-07-06 12:09:48 +01:00
John Cupitt 63bb380569 fix ASCII exif tag write
sigh libexif has three different types of string write
2018-07-04 08:50:14 +01:00
John Cupitt 3a9adbcea9 seems to work
could probably add some more fields
2018-07-03 16:36:39 +01:00
John Cupitt c12cd6d2cb not quite there
trying to set EXIF_TAG_USER_COMMENT but not working
2018-07-03 14:55:47 +01:00
John Cupitt 1cc7dd6af7 start hacking 2018-07-03 10:01:14 +01:00
John Cupitt e9aaedc60a fix some compiler warnings
from the msvc patch
2018-06-01 19:44:43 +01:00
John Cupitt b085908558 remove vips7 stuff from API
You must now include vips7 support explicitly with

	#include <vips/vips7compat.h>

in your code just after including `vips.h`.

The old vips7 names, such as `Rect`, were starting to cause problems
with other packages like opencv.
2018-05-16 15:08:21 +01:00
John Cupitt f56fbf564f oops 2018-02-01 16:28:41 +00:00
John Cupitt 5a4b4e196d allow remove thumbnail from exif
if the user has removed (or set to NULL) the "jpeg-thumbnail-data" tag,
remove it from the image EXIF on save

see https://github.com/jcupitt/ruby-vips/issues/147
2018-02-01 16:15:02 +00:00
John Cupitt 9c8790b40a setting EXIF data blocks sets other tags too
calling vips_image_set() to set the EXIF data block VIPS_META_EXIF_NAME
will automaticaly set other tags, like orientation etc.
2017-11-27 15:15:21 +00:00
John Cupitt 6013962288 better exif write
only remove exif fields not on the image if we made the exif from the saved exif data on the image
2017-11-27 05:54:10 +00:00
John Cupitt cfa96f735a only read ifd0 orientation
we used to set orientation from the first ifd, now just read ifd0, since
that's where the main image orientation should always be

see https://github.com/jcupitt/libvips/issues/772
2017-10-14 21:54:31 +01:00
John Cupitt ab6bb83266 fix a memleak in exif parsing 2016-11-10 11:09:49 +00:00
John Cupitt 3d459a82c1 don't write webp metadata we can't read back
stops tests failing
2016-11-08 17:08:41 +00:00
John Cupitt 47222bc1f5 move exif handling out to exif.c
now used by webpload as well
2016-11-07 12:20:56 +00:00