Commit Graph

1841 Commits

Author SHA1 Message Date
John Cupitt acd9101037 always copy before exif_update
During write, we often call vips__exif_update(). This updates the exif
block from the other image metadata prior to save.

Always copy the image before calling this.

See https://github.com/lovell/sharp/issues/1986
2019-11-28 14:45:02 +00:00
John Cupitt b003b36d7a Merge branch '8.8' 2019-11-27 15:30:33 +00:00
John Cupitt 0bc49a485e remove use of realpath
It won't work on linux systems with grsec.
2019-11-27 15:14:42 +00:00
John Cupitt 49a8f0779d Merge branch '8.8' 2019-11-26 09:15:39 +00:00
John Cupitt 298002c530 fix build with imagemagick 6.7.8.9
Ships with centos7, so an important version to support.

See https://github.com/libvips/libvips/issues/1479
2019-11-25 15:44:28 +00:00
John Cupitt 486b95eb7b
Merge branch 'master' into add-stream-object 2019-11-19 17:08:03 +00:00
John Cupitt 712157cd16 better support for TIFFs with many alphas
The premultiplied alpha can be in any position, and it checks if there
is more than one ASSOCALPHA.

See https://github.com/libvips/libvips/issues/1471
2019-11-18 16:48:34 +00:00
John Cupitt 6b5035c160 update changelog 2019-11-15 17:30:31 +00:00
John Cupitt c1a027c8d7 ppm load uses streams 2019-11-14 12:57:39 +00:00
John Cupitt cb7bc24b2a note in changelog 2019-11-12 18:05:17 +00:00
John Cupitt 55024c71ce
Merge branch 'master' into add-stream-object 2019-11-12 14:08:02 +00:00
John Cupitt ceb2db513d Merge branch '8.8' 2019-11-11 18:05:57 +00:00
John Cupitt b8ea3f8442 update cpp interface for stream variable rename 2019-11-11 09:24:45 +00:00
John Cupitt b65a9d7328 oop, missing ! on tiff save
resolution-unit metadata was not being checked correctly on tiff save,
thanks @kayarre

see https://github.com/libvips/pyvips/issues/133
2019-11-10 10:26:13 +00:00
John Cupitt f499cefb0e add iiif layout to dzsave 2019-11-09 20:40:39 +00:00
John Cupitt edca486f19 revise buffered input
rad load works now
2019-11-06 16:35:19 +00:00
John Cupitt 8eeb415b09 Merge branch 'master' into add-stream-object 2019-10-28 05:10:11 +00:00
John Cupitt 8337e17428 add no_strip option to dzsave
it's sometimes useful to have pyramid tiles with ICC profiles

see https://github.com/libvips/libvips/issues/1451
2019-10-21 16:46:20 +01:00
John Cupitt 20cb0da247 test suite passes
with all jpegload coming via VipsStreamInput
2019-10-11 14:03:10 +01:00
John Cupitt c9a7b92eeb version bump 2019-09-17 17:16:26 +01:00
John Cupitt efdf33f3de add vips_error_buffer_copy()
Add vips_error_buffer_copy() to fix a race in error buffer fetch.

See https://github.com/libvips/libvips/issues/1423

Thanks @dineshkannaa
2019-09-12 09:49:49 +01:00
John Cupitt 7b2729adfa fix up nifti load/save
- use double for all floating point scalar metadata, like other loaders
- remove use of stray "n" property
2019-09-09 16:06:22 +01:00
John Cupitt dd9eba9e26 add @format and @interpretation to rawload 2019-09-05 16:25:55 +01:00
John Cupitt 1ee54bfa80 Merge branch '8.8' 2019-09-05 12:45:08 +01:00
John Cupitt 06fdc95038 xres/yres params in tiffsave were in cm
and should have been in pixels/mm

thanks f--f

see https://github.com/libvips/libvips/issues/1421
2019-09-04 17:02:24 +01:00
John Cupitt da8cee048f enable alpha in heifsave
Check for image alpha and enable it. There seem to be some
non-transparent tiles, curiously.

See https://github.com/libvips/libvips/issues/1411
2019-09-01 16:58:50 +01:00
John Cupitt 75b45cc2ef enable alpha handling in heic load
use RGBA decoding, when appropriate

see https://github.com/libvips/libvips/issues/1411
2019-09-01 16:37:43 +01:00
John Cupitt 4b5b982711 merge 8.8 2019-08-31 12:29:50 +01:00
John Cupitt 574be4380e revert sharpen restoring the input colourspace
icc_export can make _RGB images, so the input can be outside the set of
supported colourspace transforms.

See 46212e92b1 (r34904985)

bump version too.
2019-08-31 11:29:36 +01:00
John Cupitt 5d19bcf955 Merge branch '8.8' 2019-08-30 11:03:24 +01:00
John Cupitt 6ea76f9632 improve data_length handling in jpg load
libjpeg uses unsigned ints for data length, so we must use size_t
everywhere.
2019-08-30 11:00:25 +01:00
John Cupitt 349e76bb85 Merge branch '8.8' 2019-08-29 15:30:20 +01:00
John Cupitt 3161de3b52 verify bands/format for coded vips images
WHen loading a vips image with Coding set, make sure that Bands and
BandFmt are correct.
2019-08-29 15:28:55 +01:00
John Cupitt 9a5dca1ef8 Merge branch '8.8' 2019-08-28 10:05:12 +01:00
John Cupitt 46212e92b1 fix default sharpen
sharpen with sigma 0.5 was doing nothing, since the new int precision
rules meant that we generated a point-point convolution.

This patch increases the int precision for sharpen, so we now work with
sigma down to 0.5.

Also: restore input colourspace. Previously, the output image was always
LabS (the computation space for sharpen). Now, it transforms back to the
input space. This is more in line with how other operators work.

Thanks 2h4dl for pointing this out.

See https://github.com/libvips/pyvips/issues/123
2019-08-28 09:16:40 +01:00
John Cupitt 2f6cc1fad9 Merge branch '8.8' 2019-08-27 14:49:42 +01:00
John Cupitt d61a85f6c9 prevent over-pre-shrink in thumbnail
We could pre-shrink so much that an axis went to 0.

See https://github.com/lovell/sharp/issues/1782#issuecomment-525249430
2019-08-27 14:47:36 +01:00
John Cupitt d2ab993931 Merge branch '8.8' 2019-08-27 13:06:27 +01:00
John Cupitt 5cce83a294 check image bounds for GIF load
It seems giflib does no checking of image dimensions at all, not even
height == 0.
2019-08-27 13:04:28 +01:00
John Cupitt 23d0d5603d Merge branch '8.8' 2019-08-24 17:15:45 +01:00
John Cupitt 4691260540 better feof() handling in gif load
Relaxing the read error rules made looping possible .. make sure we
always stop explicitly on eof.
2019-08-24 17:14:10 +01:00
John Cupitt 77de39320a Merge branch '8.8' 2019-08-24 11:21:48 +01:00
John Cupitt 038409093f clip coding and interpretation on image read
They could be out of bounds enums. This used not to matter, but we use
them more now, so out of bounds values can cause coredumps.
2019-08-24 11:20:45 +01:00
John Cupitt 1b57c6d066 Merge branch '8.8' 2019-08-23 15:43:12 +01:00
John Cupitt 4b677fb16a make GIF parse less strict
Some GIFs don't follow the standard very closely. Let them through.

See https://github.com/libvips/libvips/issues/1404
2019-08-23 15:40:48 +01:00
John Cupitt 19a80e4efb Merge branch '8.8' 2019-08-21 17:37:16 +01:00
John Cupitt b5e8e99746 fix a read-one-byte-beyond issue in jpeg load
libvips could harmlessly read beyond the end of a string with a crafted jpg
file
2019-08-21 17:17:54 +01:00
John Cupitt ed2054dbbc revise arithmetic with const
there's a problem with out of bounds values, for example:

	vips relational_const k2.jpg x.v equal 1000

actually finds pixels == 255, since 1000 is saturated converted to 255
before the test starts.

This patch reworks arithmetic against const values to fix this.
2019-08-21 10:35:48 +01:00
John Cupitt 2d0c21279a add tests 2019-08-19 16:27:44 +01:00
John Cupitt d80ce4bf15 fix a problem with shrinkv tail processing
Tail processing in shrinkv had an implicit assumption of round-down, but of
course we round to nearest. Thanks angelmixu.

see https://github.com/libvips/libvips/issues/1396
2019-08-13 11:21:01 +01:00
John Cupitt cdee0feb93 Merge branch '8.8' 2019-08-09 10:12:55 +01:00
John Cupitt aafc2c7948 add changelog note for profiles.c fix 2019-08-09 10:11:45 +01:00
John Cupitt 988f9594f4 Merge branch '8.8' 2019-08-08 16:11:02 +01:00
John Cupitt ff58c67e33 add locks for pdfium load
We used to lock within documents, ie. we did not allow two threads to
work on the same file.

However pdfium is not threadsafe in any way, and this is not supported,
see:

	https://groups.google.com/forum/#!msg/pdfium/kyIdh_J4csg/K1LvfPiHDwAJ

This patch adds locks around pdfium calls.

see:

	https://github.com/libvips/libvips/issues/1380
	https://github.com/libvips/libvips/issues/1275
2019-08-08 15:54:16 +01:00
John Cupitt 7250b169d4 Merge branch '8.8' 2019-08-07 16:19:23 +01:00
John Cupitt f36927e78d fix build against graphicsmagick
- add tests for more features missing in GM
- simplify the IM/GM configure tests
- revise the test suite to pass with GM and IM
2019-08-07 16:17:27 +01:00
John Cupitt f0d1a5d82b note PNG comment fix 2019-08-02 10:11:16 +01:00
John Cupitt 332e97272a Merge branch '8.8' 2019-07-29 10:07:29 +01:00
John Cupitt 5e77ab948b fix loop with malformed ppm
skip_line in ppm parse was not testing for EOF, so it could get stuck
with malformed files

thanks Kyle-Kyle

see https://github.com/libvips/libvips/issues/1377
2019-07-29 10:05:55 +01:00
John Cupitt 6a75776272 Merge branch 'loader-minimise-experiment' 2019-07-28 17:23:01 +01:00
John Cupitt 0e5447e537 final cleanup 2019-07-28 17:15:54 +01:00
John Cupitt 264f41df1c Merge branch '8.8' 2019-07-24 16:07:39 +01:00
John Cupitt 3510e7abcf fetch HEIC metadata from the main image
since thumbs don't have it, see https://github.com/libvips/libvips/issues/1373
2019-07-24 16:06:49 +01:00
John Cupitt 7f3174c3e5 Merge branch 'master' into loader-minimise-experiment 2019-07-23 11:45:24 +01:00
John Cupitt 03bf5a05fa note fuzz in ChangeLog 2019-07-21 18:02:57 +01:00
John Cupitt 2c654060f9 experiment with a different early-close strategy
We close loaders early in order to save file handles, and on Windows to
make sure that files can be deleted as soon as possible.

Currently loaders do this by watching the Y coordinate of requests and
freeing the fd when the final line of the file is fetched. This is messy
and does not always work, since there are cases when the final line is
not fetched.

Instead, this patch gets loaders to listen for "minimise" on their
output and close on that. This signal is emitted on all upstream images
whenever a threadpool finishes a scan of an image and is usually used to
trim caches after computation.

See https://github.com/libvips/libvips/issues/1370
2019-07-20 16:31:30 +01:00
John Cupitt 64a6a27326 Merge branch '8.8' 2019-07-19 11:59:38 +01:00
John Cupitt 8cf6a9f9ca don't attempt to save large XMP to JPG
jpeg_write_marker() with some libjpeg versions will throw a fatal
error with large chunks.

To write >64kb XMP it you need to parse the whole XMP object,
pull out the most important fields, code just them into the main
XMP block, then write any remaining XMP objects into a set of
extended XMP markers.

http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3.pdf

Instead, just warn and skip large XMP blocks.

see https://github.com/libvips/libvips/issues/1372
2019-07-19 11:37:36 +01:00
John Cupitt 044f8b74f6 Merge branch 'master' into add-tiff-webp-zstd 2019-07-11 13:50:47 +01:00
John Cupitt c3e7504835 Merge branch '8.8' 2019-07-10 17:44:39 +01:00
John Cupitt 5e2d66d14b better early shutdown behaviour in shrinkv
read the tail of the input to force early shutdown in seq readers

does reducev need something similar?

see https://github.com/kleisauke/net-vips/issues/12
2019-07-09 16:58:30 +01:00
John Cupitt 52ee3b083f add webp and zstd support to tiffsave
needs some tests still
2019-07-08 10:39:44 +01:00
John Cupitt c7f98ad0a5 Merge branch '8.8' 2019-07-07 13:12:51 +01:00
John Cupitt e4cff876a8 fix make dist
we'd renamed a file
2019-07-07 11:20:28 +01:00
John Cupitt f45f0ecef4 limit resize if shrink would drop axis <1px
vips_resize() will break the aspect ratio and limit resize on an axis if
it would result in an image of less than 1px on that axis

see https://github.com/lovell/sharp/issues/1782#issuecomment-508921306
2019-07-07 10:19:33 +01:00
John Cupitt 3871369d3e Merge branch 'master' into deftomat-master 2019-07-06 14:50:40 +01:00
John Cupitt 777c360774 safer gifload delay array init
- remove assumptions about n_pages
- minor reformatting
2019-07-06 11:34:20 +01:00
John Cupitt 80f247cfb2 Merge branch '8.8' 2019-07-03 15:33:43 +01:00
John Cupitt 8cb2b613b7 note new heifsave param in changelog
plus tiny reformatting
2019-07-03 15:04:58 +01:00
John Cupitt 26100041e7 fewer warnings on tiffload
We were setting TIFFTAG_JPEGCOLORMODE == JPEGCOLORMODE_RGB for *all*
images, but libtiff warns if you use it on an image which is not
jpg-compressed.

Only set it for jpg-compressed images.

See https://github.com/libvips/libvips/issues/1329
2019-07-02 12:23:53 +01:00
John Cupitt e596fe5cd3 Merge branch 'master' into add-unlimited-to-svgload 2019-07-01 12:04:54 +01:00
John Cupitt 55e49831b8 add "unlimited" to svgload
By default librsvg blocks SVGs > 10MB for security. This patch adds an
"unlimited" flag to remove this check.

We have to switch to using gio to get the librsvg API for this This
needs testing on the platforms we support.

We'll also need to bump the min version of librsvg we require in
configure.ac.

See https://github.com/libvips/libvips/issues/1354
2019-06-28 13:48:18 +01:00
John Cupitt 8a354c5aec improve webp rgba handling
disable webp alpha output if all frame fill the canvas and are solid

see https://github.com/libvips/libvips/issues/1351
2019-06-27 18:44:38 +01:00
John Cupitt 72c103f95a Revert "remove no-alpha webp support"
This reverts commit d1094847a3.
2019-06-27 17:27:53 +01:00
John Cupitt 80648c2d2f text autofit could sometimes underfit
The autofit loop would terminate if either width or height fitted exactly,
but this could happen very early by chance. This patch makes it keep
looping until it finds a dpi which just fits.

See https://github.com/libvips/libvips/issues/1352
2019-06-27 17:19:53 +01:00
John Cupitt d1094847a3 remove no-alpha webp support
We used to try to spot webp images with no alpha and load them as plain
RGB, but it turns out this is difficult to do reliably, especially
for animated images.

This patch simply removes support, so all webp images now load as RGBA.

See https://github.com/libvips/libvips/issues/1351
2019-06-27 16:37:11 +01:00
John Cupitt 2aef873fcd add vips_image_get/set_array_int() 2019-06-20 11:32:47 +01:00
John Cupitt 8a98bea063 fix vipsthumbnail for pyr tiff files
thumbnail was not testing pyramidal tiff images for pyramidness correctly.

see https://github.com/libvips/libvips/issues/1297
2019-06-19 17:56:09 +01:00
John Cupitt 75e69cc1e5 disable Orc if CET is on
If we are building with -fcf-protection (run-time checking of
indirect jumps) then Orc won't work. Make sure it's off.

Orc may support -fcf-protection in the future, but does not in June 2019.

https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fcf-protection
https://gitlab.freedesktop.org/gstreamer/orc/issues/17

see https://github.com/libvips/libvips/issues/1006#issuecomment-501802550
2019-06-14 14:22:00 +01:00
John Cupitt 37a3a6322c remove 256 band limit from arithmetic.c
there was a fixed-size array in vips__bandup()

see https://github.com/libvips/libvips/issues/1335
2019-06-12 09:22:30 +01:00
John Cupitt ad98222073 better behaviour for vips_region_fetch()
we weren't clipping the fetch area against region valid, so in some
cases we could return many more pixels than expected

see https://github.com/libvips/pyvips/issues/103
2019-06-09 20:38:13 +01:00
John Cupitt bb75535151 much faster ismagick
We used to Ping files to see if IM would load them, but this can be
extremely slow for file formats like ARW.

Instead, use GetImageMagick() ... it just checks the magic number.
2019-06-08 16:47:40 +01:00
John Cupitt eb6c803481 istiff tests first dir rather than magic number
We were testing for TIFF by checking the magic number at the head of the
file. However, formats like ARW are TIFF-like without being TIFF, and
will not load with tiffload.

Instead, try reading the whole of the first directory. This is enough to
stop tiffload trying to load files where it will simply fail
immediately, and make libvips fall back to eg. imagemagick.

see https://github.com/libvips/libvips/issues/1304
2019-06-07 17:52:13 +01:00
John Cupitt dc16f1253a fix a memleak in tiff pyr to memory
we were not freeing layers other than the top layer
2019-06-06 10:20:14 +01:00
John Cupitt 5657099223 fix composite for some combinations of blend modes
composite could get mixed up blend modes if:

- many images being composited
- some small and positioned with x/y
- at least one unskippable blend mode

phew!
2019-06-04 15:24:54 +01:00
John Cupitt bd8a6980f5 more consistent behaviour for multi-page load
Some loaders were setting page-height even when the user was loading a
single page triggering unexpected multi-page behaviour from later
savers.

New rule: only set page-height when loading more than one page.

See https://github.com/libvips/libvips/issues/1318
2019-05-29 10:10:28 +01:00
John Cupitt 02bdb8b96c better error message for "unsupported colorspace"
we just printed the enum number before
2019-05-24 17:42:10 +01:00
John Cupitt 5855321638 improve realpath() compat on older libc
older libc didn't allow a NULL for the second param
2019-05-24 15:24:18 +01:00
John Cupitt 394f9baa5e deprecate webpload @shrink, use @scale instead
We need a fractional scale for thumbnail on webp to work well. @shrink
still works, but @scale overrides it.
2019-04-30 18:29:16 +01:00
John Cupitt 3245dd301b Merge branch 'master' into szi-associated 2019-04-25 17:25:32 +01:00