Commit Graph

2193 Commits

Author SHA1 Message Date
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
John Cupitt
70182e4eac don't load modules if they are built in
Only load modules if libvips has been built as a set of modules.
Otherwise can can end up loading operations twice.
2021-07-03 11:14:58 +01:00
John Cupitt
ec1d1abf50 Merge branch '8.11' 2021-07-02 12:35:24 +01:00
John Cupitt
ad40d881dd remi's libdir patch, plus version bump to 8.11.2 2021-06-29 17:41:08 +01:00
John Cupitt
ea5972055f Merge branch '8.11' 2021-06-28 20:33:51 +01:00
John Cupitt
95bf1367ba fix jpeg tiff pyramid save
we were not copying the quant tables on lower pyr levels correctly

add a test too
2021-06-28 20:24:00 +01:00
John Cupitt
fc9e7ad2b3 Note static patch in changelog 2021-06-28 18:31:14 +01:00
John Cupitt
1b3dda5b24 enable strip chopping on TIFF load
see https://github.com/libvips/libvips/discussions/2322

thanks DavidStorm
2021-06-28 12:30:04 +01:00
John Cupitt
7512e410ca add svgload_string
simple convenience function for C
2021-06-28 11:45:56 +01:00
John Cupitt
706c2a112d Merge branch '8.11' 2021-06-23 12:25:43 +01:00
John Cupitt
b9034bf731 more startup debug output
if VIPS_INFO is set
2021-06-22 15:28:21 +01:00
John Cupitt
78c08650d3 revise win32 support in configure
update LT_INIT with new dll option
2021-06-22 11:48:06 +01:00
John Cupitt
4ee19edd46 add another C example
see https://github.com/libvips/libvips/issues/1167
2021-06-18 11:39:00 +01:00
John Cupitt
dc56a5aa65 all install programs support --version
and a version bump to 8.12 for the new dev cycle
2021-06-15 10:33:42 +01:00
John Cupitt
a0e0c4e45b note new threading model in changelog 2021-05-08 18:58:54 +01:00
John Cupitt
a2e5717e82 Merge branch '8.10' 2021-05-05 17:32:25 +01:00
John Cupitt
e19acd5148 fix load of large PPM images from a pipe
large PPM images loaded over pipes could cause a crash, thanks ewelot

see https://github.com/libvips/libvips/issues/2240
2021-05-05 17:29:50 +01:00
John Cupitt
70d76117bd Merge branch 'master' of github.com:libvips/libvips 2021-05-02 18:47:02 +01:00
John Cupitt
03f76b73b4 add "premultiply" param to tiffsave
Some programs, like indesign, only work with premultiplied alpha in TIFF. To
make TIFFs which are compatible with these programs, we'll need an extra
TIFF save flag (perhaps premultiply?) to premultiply alpha and save as
EXTRASAMPLE_ASSOCALPHA.

see https://github.com/libvips/libvips/issues/2192
2021-05-01 20:08:06 +01:00
John Cupitt
56e0b2c2c8 Merge branch '8.10' 2021-04-30 08:27:32 +01:00
John Cupitt
a560d7df50 better vips7 compat
revise the vips7 PNG wrapper to work with libspng, though performance
may be poor

thanks SkyDiverCool

https://github.com/libvips/libvips/issues/2233
2021-04-30 08:20:19 +01:00
John Cupitt
edcdf8af70 rebase add-jp2ktiff on master 2021-04-26 15:16:20 +01:00
John Cupitt
e5405c8ef3 udpate changelog 2021-04-26 09:11:02 +01:00
John Cupitt
e8cfc6b5a2
Merge branch 'master' into add-jxl 2021-04-21 14:00:06 +01:00
John Cupitt
693bc3ccbf
Merge branch 'master' into add-black-point-compensation 2021-04-19 18:53:35 +01:00
John Cupitt
4483a2edbc Merge branch 'master' into add-jxl 2021-04-14 15:08:46 +01:00
John Cupitt
f53959b824 switch font rendering to pangocairo
to make colour font rendering work
2021-04-12 15:11:18 +01:00
John Cupitt
209f2c5144 tidy up 2021-04-03 18:40:21 +01:00
John Cupitt
005360dba7 add support for lcms black point compensation
Add a --black-point-compensation flag.

See https://github.com/libvips/libvips/discussions/2169
2021-03-29 12:41:02 +01:00
John Cupitt
fd56067f54 oop, left gifload.c in the merge 2021-03-27 15:39:29 +00:00
John Cupitt
69fcf1b9e9
Merge branch 'master' into add-openjpeg 2021-03-27 15:22:13 +00:00
John Cupitt
6ab30ca732 Merge branch '8.10' 2021-03-23 23:18:48 +00:00
John Cupitt
2df5768d99 note vector fix in changelog 2021-03-23 20:53:06 +00:00
John Cupitt
2575d963bd add jp2k tests
and buffer load/save
2021-03-20 12:16:10 +00:00
John Cupitt
454f448c5b add jp2ksave
works, but not quite done
2021-03-19 11:49:07 +00:00
John Cupitt
c0ec1757cb works at a basic level
need to add shrink-on-load etc.
2021-03-17 16:38:55 +00:00
John Cupitt
fc4ad15f97 Merge branch '8.10' 2021-03-07 12:26:24 +00:00
John Cupitt
ec16c761df revise changelog for clarity 2021-03-06 12:56:35 +00:00
John Cupitt
2e56828053 Merge branch '8.10' 2021-03-06 11:47:02 +00:00
John Cupitt
1f18963cb4
Merge branch '8.10' into revise-premultiply 2021-03-05 11:17:40 +00:00
John Cupitt
86a6fd9d18 fix tiff deflate predictor setting
the enums were mixed up, thanks Adios

see https://github.com/libvips/libvips/issues/2128
2021-03-04 09:39:50 +00:00
John Cupitt
303513e52d small comment polish 2021-02-27 16:00:33 +00:00
John Cupitt
d3ccadf212 revise unpremultiply, again
We were not detecting division by zero carefully enough, nor clipping
the alpha range sufficiently in unpremultiply.

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

also see https://github.com/libvips/libvips/pull/1675 for another
difficult test case
2021-02-27 15:16:25 +00:00
John Cupitt
e5e2e8d1eb Merge branch '8.10' 2021-02-22 10:06:43 +00:00
John Cupitt
ec67002493 update changelog 2021-02-22 10:06:14 +00:00
John Cupitt
8dc2db9789 add gif background colour as metadata 2021-02-20 04:52:02 +00:00
John Cupitt
d6201fc32d note PNG background colour in metadata
see https://github.com/libvips/libvips/issues/2111
2021-02-19 16:51:46 +00:00
John Cupitt
4f762d6609 add vips_niftiload_source() 2021-02-12 15:29:58 +00:00
John Cupitt
498e9c2829 add fitsload_source
and fix some small fits loading issues
2021-02-11 16:44:53 +00:00
John Cupitt
15f4d935aa Merge branch '8.10' 2021-02-09 16:23:46 +00:00
John Cupitt
75959ece6a note librsvg change 2021-02-09 16:23:13 +00:00
John Cupitt
b30a90e3bc fix includes of glib headers in C++
see https://github.com/libvips/libvips/issues/1987
2021-02-09 16:21:56 +00:00
John Cupitt
1f4f975e7d make leak test exit with an error code
and run the libvips leak test in CI
2021-02-08 11:25:56 +00:00
John Cupitt
4605ad6993 fix another ref leak in globalbalance 2021-02-06 19:01:26 +00:00
John Cupitt
2ce79d76a0 output double histogranms for large images
since images with more than 2*32 pixels will overflow a uint accumulator

thanks @erdmann

see https://github.com/libvips/libvips/issues/1976
2021-02-01 15:51:31 +00:00
John Cupitt
29599e00eb avoid NaN in mapim
We were not avoiding NaN in float transform images, leading to segvs in
some cases.

Thanks afontenot

see https://github.com/libvips/libvips/issues/1971
2021-01-30 15:17:25 +00:00
John Cupitt
d8ed630d77 better 8/16 bit casting for pngsave
pngsave was just using the image format to decide whether to save as 8
or 16 bit PNG. With this patch it checks Type as well.

This means that eg. a uint32 image tagged as sRGB will save as png8, but
a uint32 image tagged as RGB16 will save as png16.
2021-01-16 15:45:59 +00:00
John Cupitt
3cd774a10c add fast path to rank filter for uchar images
around 10x faster for 20x20 windows, the same speed for 3x3
2021-01-12 20:36:13 +00:00
John Cupitt
0be1370661 Merge branch '8.10' 2021-01-05 03:57:06 +00:00
John Cupitt
e1a9397c15 better error detection in spngload
Do a speculative spng_get_trns() in header read to force all chunks to
be parsed.

Thanks randy408

See https://github.com/randy408/libspng/issues/145#issuecomment-744495084
2021-01-05 03:54:48 +00:00
John Cupitt
5d229e0b9e update changelog
ooops, forgot
2021-01-02 17:48:26 +00:00
John Cupitt
6fb7ca73a4 Merge branch '8.10' 2021-01-01 10:13:12 +00:00
John Cupitt
42af1cec36 add vipsload_source
plus small openslideload_source fixes
2020-12-31 19:47:36 +00:00
John Cupitt
babbb086f9 add openslideload_source 2020-12-30 14:14:08 +00:00
John Cupitt
0982d0efbb signal error on EOF in jpegload more reliably
we were only warning on EOF in the read stub, even if fail was set

thanks bozaro

see https://github.com/libvips/libvips/issues/1946
2020-12-28 22:46:33 +00:00
John Cupitt
98be88bf80 add sourceginput
This is a source which wraps a GInputStream. You can use this to eg.
efficiently load a PNG file from a GFile object.
2020-12-28 15:14:36 +00:00
John Cupitt
ac1417b410 Merge branch '8.10' 2020-12-26 17:07:17 +00:00
John Cupitt
b2fa1f89e8 revise ppmload, fixing a couple of bugs
- ppmload was not setting interpretation, filename, etc. for files read via
  mmap
- files not read via mmap were never byteswapped
- some cleanups

see https://github.com/libvips/libvips/issues/1916
2020-12-26 17:02:07 +00:00
John Cupitt
c3c9f281c0 Merge branch '8.10' 2020-12-22 14:31:08 +00:00
John Cupitt
94ecb8d38d version bump
and fix changelog dates
2020-12-22 14:28:55 +00:00
John Cupitt
eeb0fb3ac1 Merge branch '8.10' 2020-12-22 12:56:32 +00:00
John Cupitt
c3159e209d note in changelog
see https://github.com/libvips/libvips/pull/1938
2020-12-22 12:55:44 +00:00
John Cupitt
2348a02351 Merge branch '8.10' 2020-12-18 10:14:03 +00:00
John Cupitt
460efa73fa bump version for animated webp load fix 2020-12-18 10:12:26 +00:00
John Cupitt
728397d76c Merge branch '8.10' 2020-12-15 13:22:56 +00:00
John Cupitt
1b19e6f832 start 8.10.4
with a dropped patch from 8.10.3
2020-12-14 09:20:44 +00:00
John Cupitt
2db2b24200 Merge branch '8.10' 2020-12-13 03:43:51 +00:00
John Cupitt
c12730748d forgot changelog update 2020-12-13 03:43:03 +00:00
John Cupitt
7839792c1a Merge branch '8.10' 2020-12-13 03:40:03 +00:00
John Cupitt
1d2864cc41 note HEIC fix in changelog
see https://github.com/libvips/libvips/pull/1921
2020-12-10 17:54:58 +00:00
John Cupitt
25db7849e7 Merge branch '8.10' 2020-12-09 15:19:18 +00:00
John Cupitt
3996f3279b fix range clips for casts to and from int
Fix two bugs:

- clip in casts from int32 and uint32 could overflow -- do these as gint64 now

- clip in casts from float to int could overflow since float32 can't
  represent the full range of int32 without losing precision -- do these
  as double

And add some more tests.

Thanks ewelot.

see https://github.com/libvips/libvips/issues/1922
2020-12-09 15:14:59 +00:00
John Cupitt
6eaf1eda30 make webp frame blend do doround to nearest
see https://github.com/libvips/libvips/pull/1918
2020-12-04 13:53:24 +00:00
John Cupitt
5f3482bff5 Merge branch '8.10' 2020-12-03 13:58:33 +00:00
John Cupitt
587a7c2d63 note ppmload fix 2020-12-02 21:03:44 +00:00
John Cupitt
deab095b3c Merge branch '8.10' 2020-11-29 14:03:22 +00:00
John Cupitt
2585565b3e better test for output to target
We used to enable write to stdout if the first character of an output filename
was ".", eg.:

	vips copy x.jpg .png

But this will also enable write to stdout for things like:

	vips copy x.jpg ./y.png

This patch also tests that the rightmost "." in a filename is also the
first character.

Thanks barryspearce

See https://github.com/libvips/libvips/issues/1906
2020-11-29 13:59:30 +00:00
John Cupitt
864075c4f4 Merge branch '8.10' 2020-11-26 10:18:27 +00:00
John Cupitt
acc579cc9d force binary mode for connections on win
stdin / stdout (for example) are created in text mode by default on
win. We need to flip them to binary mode for connection read and write.

See https://stackoverflow.com/questions/65014352/pipe-libvips-cli-output-to-stdout-in-windows
2020-11-26 10:15:48 +00:00
John Cupitt
7948b979a5 Merge branch '8.10' 2020-11-22 16:39:04 +00:00
John Cupitt
6340e14303 byteswap on ppm save, if necessary
this was missing, thanks ewelot

see https://github.com/libvips/libvips/issues/1894
2020-11-22 16:37:24 +00:00
John Cupitt
c0bace8f91 Merge branch '8.10' of github.com:libvips/libvips into 8.10 2020-11-22 16:05:57 +00:00
John Cupitt
9f22c5dbf3 Merge branch 'master' of github.com:libvips/libvips 2020-11-22 16:05:19 +00:00
John Cupitt
3b9f9d3a12 Merge branch '8.10' 2020-11-22 16:01:58 +00:00
John Cupitt
8e25eef3d0 make ppm load default to msb first
We has lsb first as the default, breaking 16-bit PPM load. Thanks ewelot.

see https://github.com/libvips/libvips/issues/1894
2020-11-22 16:00:34 +00:00
John Cupitt
e8ff67376d Merge branch '8.10' 2020-11-21 14:26:02 +00:00
John Cupitt
c17e696243 backport gifheight check
ensure gifheight can't oevrflow

see https://github.com/libvips/libvips/pull/1892
2020-11-21 14:25:09 +00:00
John Cupitt
d7e988d16f Merge branch '8.10' 2020-11-20 12:19:01 +00:00
John Cupitt
d971c75d6f block 0 width or height images from imagemagick
IM could return 0 width and/or height for some crafted images. Block
these.

Thanks @Koen1999.

See https://github.com/libvips/libvips/issues/1890
2020-11-20 12:17:42 +00:00
John Cupitt
2772ecbb9e add "seed" param to perlin, worley and gaussnoise
see https://github.com/libvips/libvips/issues/1884
2020-11-16 09:14:06 +00:00