This patch makes "insert" issue minimise signals for inputs in sequential
mode. This can drop memory use in some programs, for example:
```python
import sys
import random
import pyvips
image = pyvips.Image.black(20000, 20000)
for filename in sys.argv[2:]:
tile = pyvips.Image.new_from_file(filename, access='sequential')
x = random.randint(0, image.width - tile.width)
y = random.randint(0, image.height - tile.height)
image = image.insert(tile, x, y)
image.write_to_file(sys.argv[1])
```
Before this patch:
```
$ for i in {0..1000}; do cp ~/pics/k2.jpg $i.jpg; done
$ /usr/bin/time -f %M:%e ../manyjoin.py ../x.jpg *.jpg
5456256:4.34
```
With this patch:
```
$ /usr/bin/time -f %M:%e ../manyjoin.py ../x.jpg *.jpg
2475324:3.38
```
This patch makes arrayjoin leave a bigger margin off the end of each
input image. This can help some loaders which have large output caches.
See https://github.com/libvips/libvips/issues/2440
Instead of a simple fail/don't-fail boolean switch, add fail-on, an enum which sets the sensitivity of loaders to errors.
There's a new sensitivity level which tries to detect truncated images, but ignores other types of error.
tell buffer and target savers the file format
Currently, buffer and target savers are not told the format they should
write.
This is usually OK (the JPEG saver already knows it should write JPEG),
but some savers can write several formats, and these currently need an
extra parameter.
For example:
```ruby
buf = x.write_to_buffer ".bmp", format: "bmp"
```
The first ".bmp" gets libvips to pick magicksave, the second
`format:` param is necessary to tell magicksave to write BMP.
This patch adds stub subclasses so that the savers know the exact format. It also improves PPM save.
Webp decode can only shrink-on-load to int boundaries. This means that frames
in an animation which only update part of the canvas can get displaced by
up to 0.5 pixels, causing juddering.
see https://github.com/libvips/libvips/issues/2379
The filemode ifdefs had grown to 30 lines of code duplicated in four
source files. Move to a single copy in a private header (not part of the
public API).
* Cleanup unused defines
* win32: do not inherit open file handles in child processes
`O_NOINHERIT` and the `N` flag of `fopen` is available in all
supported Windows versions.
* unix: ensure any open file handles are closed on exec
`O_CLOEXEC` is available since Linux 2.6.23 and is ignored on
earlier versions. `e` flag of `fopen` is available since glibc 2.7.
* allow utf-8 header for svg detection
We were checking that the first 24 chars of an SVG were plain ASCII,
but that's not always the case, for example:
<svg id="レイヤー_1のコピー"
data-name="レイヤー 1のコピー"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100">
</svg>
We now test for the string "<svg" being in the first 1000 bytes, and
everything up to that being valid utf-8.
See https://github.com/libvips/libvips/issues/2438
* raise priority of webpload
it was very low priority before, for some reason
switch GIF save to frame at a time
And make a new colormap if the frame average changes. This keeps memory use low, even for very large GIFs, though is somewhat slower.
See https://github.com/libvips/libvips/pull/2445