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
* Add jpeg restart_interval option.
This allows saving a jpeg with MCU restarts.
* Fix code style. Add description of restart_interval.
* Add a basic test based on output length.
* Update main change log.
We used to assume (in several places) that any source with a filename was
seekable. This patch adds a is_file test, and makes all the loaders use it.
see https://github.com/libvips/libvips/issues/2467