Commit Graph

2192 Commits

Author SHA1 Message Date
John Cupitt 7e961b4671 Merge branch '8.13' 2022-08-02 14:22:27 +01:00
John Cupitt 2c4c039056 add "unlimited" to jpegload
To disable DoS limits for JPEG loading. Adding API on a stable branch is
bad, but this fixes a regression, so I think it's necessary,
unfortunately.

See https://github.com/libvips/libvips/issues/2973
2022-08-02 13:50:09 +01:00
Kleis Auke Wolthuizen a6fa62605c
Cherry-pick a couple of Meson improvements to 8.13 (#2968)
* add a summary table at the end of configure

Copied from the old autotools summary. Sample clipped from "meson setup":

```
Program python3 found: YES (/usr/bin/python3)
Configuring variables.sh using configuration
Message:

*Build options
  enable debug ......................: true
  enable deprecated .................: true
  enable modules ....................: true
  enable gtk-doc ....................: true
  enable doxygen ....................: false
  enable introspection ..............: true
  enable RAD load/save ..............: true
  enable Analyze7 load/save .........: true
  enable PPM load/save ..............: true
  enable GIF load ...................: true

*Optional external packages
  use fftw for FFTs .................: true
  accelerate loops with ORC .........: true
  ICC profile support with lcms .....: true
  zlib ..............................: true
  text rendering with pangocairo ....: true
  font file support with fontcongfig : true
  EXIF metadata support with libexif : true

*External image format libraries
  JPEG load/save with libjpeg .......: true
  JXL load/save with libjxl .........: false
  JPEG2000 load/save with openjpeg ..: true
  PNG load/save with libspng ........: false
  PNG load/save with libpng .........: true
  selected quantisation package .....: imagequant
  TIFF load/save with libtiff .......: true
  image pyramid save with libgsf ....: true
  HEIC/AVIF load/save with libheif ..: true
  WebP load/save with libwebp .......: true
  PDF load with PDFium ..............: false
  PDF load with poppler-glib ........: true
  SVG load with librsvg .............: true
  EXR load/save with openexr ........: true
  OpenSlide load ....................: true
  Matlab load with libmatio .........: true
  NIfTI load/save with niftiio ......: true
  FITS load/save with cfitsio .......: true
  GIF save with cgif ................: true
  selected Magick package ...........: MagickCore
  Magick load/save ..................: true

Build targets in project: 53
...
```

* Meson: improve summary table (#2943)

* Meson: improve summary table

* Fix typo

* Remove redundant whitespace

* Fix libpng fall-back when build with `-Dspng=disabled` (#2955)

* Meson: simplify dynamic module handling (#2956)

* Deduplicate `--vips-config` with the build summary (#2957)

* Deduplicate `--vips-config` with the build summary

* Ensure output is identical

Helps parses.

* Fix summary when build with `-Dnifti=disabled` (#2963)

* Update ChangeLog

Co-authored-by: John Cupitt <jcupitt@gmail.com>
2022-07-31 10:09:00 +01:00
John Cupitt 8c71424e9a version bump
and changelog update
2022-07-30 12:37:30 +01:00
John Cupitt 5e93ac43ac bump 8.13 version 2022-07-26 12:20:43 +01:00
Lovell Fuller 1bf1a32f2c
pngsave: Change default row filter from 'all' to 'none' (#2929)
as this is usually faster and produces a smaller file size
2022-07-15 19:20:42 +01:00
John Cupitt 26f8b8a249 vips_block_untrusted_set was named wrongly 2022-06-10 18:08:27 +01:00
John Cupitt 6260a37136
add libjxl ICC and scRGB support (#2815)
* add ICC and scRGB support

see https://github.com/libvips/libvips/issues/2568

* final polish
2022-05-28 13:55:45 +01:00
Daniel Löbl ed79cfba7e
magicksave: Add bitdepth option (#2819)
* flag to save bmp with bitdepth 1

* magicksave: add bitdepth option

* update comments

* update documentation

* revised based on review comments

Co-authored-by: Thomas Barton <thomasryanbarton@gmail.com>
2022-05-27 11:41:01 +01:00
Daniel Löbl f26f0b09b8
cgifsave: reuse global palette, if possible (#2797)
* save GIF palette as metadata

... if there are no local colour tables.

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

* cgifsave: reuse global palette, if possible

* add reuse_palette parameter

* add reoptimise parameter and reuse palette by default

* attach global palette even if local palettes are present

* add check for presence of use-lct

* Revert "add check for presence of use-lct"

This reverts commit cd0f14e45e8bed8f108ee9666e2569c6355f17eb.

* Revert "attach global palette even if local palettes are present"

This reverts commit 4085b9e14b73c8990e9653ccc6f90477c2a43032.

* move global palette quantization to cgif_build

* rename member variable gct

* update comments

* improve error handling

* update documentation

Co-authored-by: John Cupitt <jcupitt@gmail.com>
2022-05-23 13:01:26 +01:00
John Cupitt 3d0912ea68 Merge branch '8.12' 2022-05-21 09:53:37 +01:00
John Cupitt 6e80364e0a fix jxl compat break
note in changelog

see https://github.com/libvips/libvips/pull/2813
2022-05-21 09:52:58 +01:00
Daniel Löbl 7f8e059dc6
webpsave: add parameter for mixed encoding (#2810)
* webpsave: add mixed parameter

* update changelog

* update webpsave documentation
2022-05-20 18:47:18 +01:00
John Cupitt a9d64bea54
add dzsave to a target (#2718)
* start adding dzsave to a target

made a thing for gsf to write to a target

* fix stray tabs in dzsave

* fix dzsave write to "."

Early versions of libgsf did not support writing to ".", so we had an ugly
workaround, but this should now be OK.

Fixing this ought to make write to target simple

* dzsave_target compiles

no idea if it works though

* seems to work now

creates stray 0 length files though, very odd

* fix stray files from dzsave

next: save to buffer is returning null

* fix buffer flush in dzsave

all tests pass!

* update changelog
2022-05-20 18:38:46 +01:00
John Cupitt f8003bda67
Add tiffsave target (#2798)
* compiles, but untested

* works, but libtiff needs seek for write

next: add seek methods to target

* add target seek and read

seem to work

next: disc temps for disc output

* add libnsgif COPYING

oops, we were missing the COPYING file

see https://github.com/libvips/libvips/issues/2800

thanks mika-fischer

* tiffsave uses a disc temp if it can

* revise temp target rules

only make a disc temp if we are writing to a filesystem target

* add new target methods to targetcustom
2022-05-20 18:38:17 +01:00
John Cupitt 58b53506ff
add vips_target_end (#2802)
since finish did not return an error code

also make sure we don't call target_end from inside _dispose, since that
can't signal error either

see https://github.com/libvips/libvips/issues/2801
2022-05-20 16:38:04 +01:00
John Cupitt 683e8d9b6f small changelog polish 2022-05-16 14:59:16 +01:00
John Cupitt dd9f42269f Merge branch '8.12' 2022-05-11 22:31:13 +01:00
John Cupitt 36cc50500b update changelog for ssize_t fix 2022-05-11 22:30:42 +01:00
John Cupitt cdcafbc4c5 add changelog notes
and linewrap for 80 column limit
2022-05-07 12:51:58 +01:00
John Cupitt f06c9f3bcf add fail-on to thumbnail
see https://github.com/libvips/libvips/discussions/2781
2022-04-28 09:08:34 +01:00
John Cupitt 43db3985d0 try to always set the min stack size
since musl users often don't know about this

see https://github.com/libvips/libvips/issues/2761
2022-04-19 16:41:18 +01:00
John Cupitt eba9ec0dd7
Add a way to disable less well tested operations (#2636)
* quick proposal

warn on startup if untrusted operations might run

use vips_block_untrusted_set() to block untrusted operations, set an env
var or make a file to stop the warning

* mark fits, nifti and svg as untrusted

* remove the annoying "untrusted" warning message

better to warn on the download page

leave vips_block_untrusted_set() since it's obviously useful

* separate UNTRUSTED and BLOCKED

* typos

* add VIPS_BLOCK_UNTRUSTED env var

* move BLOCK_UNTRUSTED after plugin load

obviously, ooops

* add a test, disable *magick

although *magick is fuzzed, it's probably safer to disable it in
untrusted environments

* mark some more operations as untrusted
2022-04-11 11:32:32 +01:00
John Cupitt 39e75e07a2 deprecate "properties", register ".szi" as a suff 2022-03-29 17:50:48 +01:00
John Cupitt 168d7652c2 Merge branch '8.12' 2022-03-11 16:25:11 +00:00
John Cupitt f0eb493643 fix thumbnail with cmyk output
see https://github.com/libvips/php-vips/issues/138

thanks AdamGaskins
2022-03-11 16:21:12 +00:00
John Cupitt f65b615a17 minor nsgifload revisions
- add note to changelog
- remove dead code
- improve debug output
- track current page number

see https://github.com/libvips/libvips/pull/2699
2022-03-03 11:49:13 +00:00
John Cupitt 3b6072437d add new param to gifsave docs
also note in changelog and revise layout for 80 columns

see https://github.com/libvips/libvips/pull/2628
2022-02-28 16:38:02 +00:00
John Cupitt 3073ee90b7
Improve edge handling for mapim (#2681)
* almost there

* smol changes

* getting close now

segv on the test suite, annoyingly

* argh still not quite thert

* phew
2022-02-28 09:12:09 +00:00
shado23 3a45d6e842 Add support for regions in the C++ API 2022-02-25 16:19:44 +01:00
John Cupitt 5ff96da873 add note on heifload unlimited to changelog 2022-02-23 10:35:46 +00:00
John Cupitt e985e23c09
add HDR support to heif load/save (#2596)
* heifload done, doing save

* finish save, add tests, docs
2022-02-18 11:16:15 +00:00
John Cupitt f6dafd6fc6 update changelog for intospection fixes
and default on, since there are now so few warnings
2022-02-15 10:59:11 +00:00
John Cupitt 896cad6a7a
Add spngsave (#2536)
* quick hack

won't even compile

* works!

at a basic level, anyway

* start wiring up metadata

* metadata done

* add spng interlaced save

* start adding index support

* fix palette save

* Update libvips/foreign/spngsave.c

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>

* start adding low bit depth write

* add a warning for low bitdepth write

* small fixes

* add 1/2/4 bit write

adapted from the vips2tiff bit packer

* small polish

* note spngsave in changelog

* Update libvips/foreign/spngsave.c

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>

* Update libvips/foreign/spngsave.c

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>

* revise 8 and 16-bit PNG write rules

* cleanup

* remove unnecessary palette filter optimisation

since libspng already does this

* add xres/yres rounding

thanks klies

he commit message for your changes. Lines starting

* look for spng.pc and libspng.pc

It can be called either, frustratingly.

* fix PACKAGES_USED for spng .pc changes

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2022-02-11 16:30:23 +00:00
John Cupitt 17aa0de325 credit meson build in changelog
see https://github.com/libvips/libvips/pull/2637
2022-02-08 15:20:49 +00:00
John Cupitt 8c668303f8 improve the pixel rng
see https://github.com/libvips/libvips/issues/2642
2022-02-02 18:15:26 +00:00
John Cupitt cb78b1b9fb add "password" option to pdfload
loads at least AES128-encrypted PDFs

pdfiumload needs a similar feature

see https://github.com/libvips/libvips/issues/2635
2022-01-28 13:25:46 +00:00
John Cupitt 0a7e96a4e2 Merge branch '8.12' 2022-01-28 08:51:27 +00:00
John Cupitt 68a8bf42a7 better arg checking for hist_find_ndim
we were not checking the number of input bands

move checks to _build

thanks travisbell

see https://github.com/libvips/libvips/issues/2634
2022-01-28 08:47:30 +00:00
John Cupitt 535657a203 Merge branch '8.12' 2022-01-24 12:12:57 +00:00
John Cupitt 5c249e0e8e note pipe read fix in changelog 2022-01-24 12:12:32 +00:00
John Cupitt cfa7f03278 Merge branch '8.12' 2022-01-18 18:23:20 +00:00
John Cupitt 774c969d43 fix GIF save change detector
We were only using the top 25% of the frame for GIF pallette change
detection.

Thanks TheEssem

See: https://github.com/libvips/libvips/issues/2622
2022-01-18 18:15:38 +00:00
John Cupitt 545933255e note jp2k load just in changelog 2022-01-18 12:30:06 +00:00
John Cupitt ce54b4e5ad Merge branch '8.12' 2022-01-13 11:47:53 +00:00
John Cupitt 6b475c92a2 raise linpng size limit
By default libpng is limited to 1m pixels per axis. Raise this to
VIPS_MAX_COORD, ie. 10m pixels.
2022-01-13 11:44:28 +00:00
John Cupitt c278f9019d Merge branch '8.12' 2022-01-01 00:29:26 +00:00
John Cupitt f75b3c1ee9 adjust GIF alpha threshold
see https://github.com/libvips/libvips/discussions/2604
2021-12-31 20:20:56 +00:00
John Cupitt eb906f182d Merge branch '8.12' 2021-12-22 10:26:57 +00:00
John Cupitt d3f77e4433 add a sniffer for TTF
since TTF files can be caught by the almost unfixably overgenerous TGA sniffer

see https://github.com/libvips/php-vips/issues/127
2021-12-22 10:25:52 +00:00
John Cupitt 062df97a5d Merge branch '8.12' 2021-12-21 09:48:02 +00:00
John Cupitt 6020d25be4 update changelog for iiif change 2021-12-21 09:47:23 +00:00
John Cupitt 067407af31 Merge branch '8.12' 2021-12-18 18:23:28 +00:00
John Cupitt 9420911ba8 change default GIF frame delay from 1s to 0.1s
This is the delay if the GCB is missing.

See https://github.com/libvips/libvips/issues/2582
2021-12-18 18:08:30 +00:00
John Cupitt 0a824517fa Merge branch '8.12' 2021-12-16 10:58:29 +00:00
John Cupitt 65d84d1cbe fix a crash with 0 length vectors 2021-12-16 10:45:10 +00:00
John Cupitt 47be1fcc6f Merge branch '8.12' 2021-12-09 13:01:51 +00:00
John Cupitt 6d23a3615e add a fallback path for gif save if no cgif
Via imagemagick. See https://github.com/libvips/libvips/issues/2574
2021-12-09 13:00:58 +00:00
John Cupitt 5b089951ac Merge branch '8.12' 2021-12-06 14:04:49 +00:00
John Cupitt cd80b5ae94 note win fd change in changelog 2021-12-06 13:58:46 +00:00
John Cupitt ba5afffd68 Merge branch '8.12' 2021-11-26 11:12:47 +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 728f2e2905 Merge branch '8.12' 2021-11-21 15:13:17 +00:00
John Cupitt edf63dfeeb fix insert
We were not detecting the shortcut cases for insert correctly, thanks
chreru.

See https://github.com/libvips/libvips/issues/2548
2021-11-21 14:50:55 +00:00
John Cupitt b889181966 version bump for 8.13
and revise quant package detection
2021-11-21 11:29:28 +00:00
John Cupitt 09771a54ea fix typos 2021-11-14 21:47:43 +00:00
John Cupitt ad295b5d41 add changelog notes 2021-11-13 14:36:38 +00:00
John Cupitt 6f081de0a0 add minimise to insert
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
```
2021-11-05 12:14:50 +00:00
John Cupitt 30fdc3df77 add jp2k load of untiled images
with this patch, untiled jp2k images are loaded in chunks, saving loads
of memory (but runs much slower)
2021-11-04 15:26:04 +00:00
Heshy Roskes d8c04011ea
Add hyperbolic functions (#2508)
* add hyperbolic functions
* add hyperbolic function tests
* changelog
* add inverse hyperbolic functions for old compilers
2021-11-02 15:05:37 +00:00
John Cupitt 9f37857254 note fail-on in changelog 2021-10-31 14:15:20 +00:00
John Cupitt 47383b5bfc
tell buffer and target savers the file format (#2499)
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.
2021-10-28 18:57:24 +01:00
John Cupitt 21567e12b8 note atan2 in changelog 2021-10-20 20:42:23 +01:00
John Cupitt 0f3193b7f2
Add iiif3 (#2483)
* add iiif3 support to dzsave

some small things have changed from v2
2021-10-19 14:18:40 +01:00
David Manthey 46a67cfab9
Add jpeg restart_interval option. (#2468)
* 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.
2021-10-08 17:33:32 +01:00
John Cupitt f6281284a1 fix VipsSource and named pipes
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
2021-10-08 12:20:24 +01:00
John Cupitt 5397fe5a4f note tiff change in changelog 2021-09-29 17:49:26 +01:00
John Cupitt b96ed28903 update docs for vips_shutdown() use
Since we have a new policy.
2021-09-17 19:09:07 +01:00
John Cupitt 7e8af07c66
Fix flatten clip (#2432)
* fic gtk-doc typenames in cgif

* fix flatten clipping

flatten could produce out of range values if max_alpha was less than
the limit of the numeric range of the format

https://github.com/libvips/libvips/issues/2431
2021-09-13 11:23:02 +01:00
John Cupitt f8c2a36746 arrayjoin signalling minimise also frees memory
By making the sequential line cache non-persistent, and only minimising
when the read point is well past the image.

On large arrayjoin operations, this saves many GB of memory.

See https://github.com/kleisauke/net-vips/issues/135
2021-09-06 23:14:36 +01:00
John Cupitt a20cd4cdc1 minimise arrayjoin inputs during processing
arrayjoin with a sequential pipeline will now minimise inputs when they
are no longer being used. This drops the number of open file handles
needed to construct large arrays.

Sadly, memory savings are minimal.

see https://github.com/kleisauke/net-vips/issues/135
2021-09-06 20:22:29 +01:00
John Cupitt d5b40793b0 Merge branch '8.11' 2021-09-05 12:02:14 +01:00
John Cupitt c5a6331d5e note thumbnail fix in changelog 2021-09-05 12:01:51 +01:00
John Cupitt 307d24eea7 Merge branch '8.11' 2021-08-30 14:02:28 +01:00
John Cupitt b62287a792 check .v enums more carefully 2021-08-30 14:02:03 +01:00
John Cupitt 26f5da19e9 Merge branch '8.11' 2021-08-30 12:44:06 +01:00
John Cupitt 6444bfb5bb note coding fix in changelog 2021-08-30 12:43:43 +01:00
John Cupitt b9230edcbe Merge branch '8.11' 2021-08-29 19:13:12 +01:00
John Cupitt 451cfcd282 small cleanups from "unlimited" option 2021-08-29 19:08:51 +01:00
John Cupitt b0b8e6ee65 small style changes 2021-08-23 01:14:37 +01:00
John Cupitt e60f11eb45 fix rank fast path
there was an off-by-one error which could cause an out of bounds read

see https://github.com/libvips/libvips/issues/2401
2021-08-16 17:46:25 +01:00
John Cupitt e93a23e0b7 Merge branch '8.11' 2021-08-05 12:29:11 +01:00
John Cupitt 5263686511 limit the number of text chunks in PNGs
very large numbers of text chunks can cause high memory use
2021-08-05 12:28:22 +01:00
John Cupitt 8082063607 rename webp reduction-effort as effort
though effort still works
2021-07-30 11:07:43 +01:00
John Cupitt 08d3c32868 Note jxlsave protos 2021-07-19 07:57:48 +01:00
John Cupitt 2041f228f5 fix thumbnail with small plus crop plus no upsize
thumbnail could fail for small images if upsize was disallowed and crop
was enabled, thanks Andrewsville

see https://github.com/libvips/libvips/issues/2157
2021-07-18 15:00:35 +01:00
John Cupitt b493b16e54 Merge branch '8.11' 2021-07-16 10:23:19 +01:00
John Cupitt 6946c3b9d9 start up threadpool later
might help php and ruby web frameworks

see eg. https://github.com/libvips/php-vips-ext/issues/42
2021-07-14 20:21:38 +01:00
John Cupitt 6dd6fafa2a Merge branch '8.11' 2021-07-03 11:47:26 +01:00
John Cupitt ee865253a6 not jp2k pyr fix in changelog 2021-07-03 11:17:33 +01:00