Commit Graph

5705 Commits

Author SHA1 Message Date
John Cupitt 1297f2c6d7
add suport for N colour ICC profiles (#3046)
* seems to export to cmyk+2 correctly

We'll need something fancier for import.

* more hacking

* Revert "more hacking"

This reverts commit fcdad5b491fc4d5a1750388947e42d1e98b1d9d7.

* generalise to many colour export

Should work up to 12 colour profiles (all that lcms supports).

* support import with N-colour profiles
2022-10-19 09:19:18 +01:00
John Cupitt f0bb3e3442 Merge branch '8.13' 2022-10-14 20:06:34 +01:00
Sergey Alexandrovich c6498e5c2c
spngsave: fix transparency (#3074) 2022-10-14 20:05:29 +01:00
Kleis Auke Wolthuizen f38acdef1a
spngsave: ensure quantisation occurs last (#3073)
* spngsave: ensure quantisation occurs last

i.e. after setting the metadata and phyiscal pixel dimensions,
since quantisation will overwrite the image.

* spngsave: avoid over-allocation of temporary buffer

For low-bitdepth write and palette-based output.
2022-10-14 19:29:29 +01:00
Daniel Löbl 9c2accf831
webpsave: switch to g_try_malloc() and limit WebP output dimensions (#3094)
* webpsave: switch to g_try_malloc()

* webpsave: add dimensions limit check

* output the amount of memory requested on malloc error
2022-10-14 15:35:07 +01:00
John Cupitt b661f4bc27 revise formatting 2022-10-12 18:27:10 +01:00
John Cupitt ab2e0bf38c Merge branch '8.13' 2022-10-11 08:49:03 +01:00
John Cupitt fbef674625 better rules for 16-bit heifsave
now parallel 16-bit PNG save

see https://github.com/libvips/libvips/discussions/3087
2022-10-11 08:45:24 +01:00
Corentin Noël 5fcca56fe8
Introspection improvements (#3079)
* vala: Enhance the metadata to contain more symbols

* Enhance the introspection coverage

Always set data with destroy function as transfer full.
2022-10-06 17:28:33 +01:00
John Cupitt 69b139dfff Merge branch '8.13' 2022-09-29 05:55:18 +01:00
Lovell Fuller d3a1d4df1b
spngsave: name ICC profiles (#3068)
The PNG spec requires that the iCCP chunk has a profile name with
a minumum length of 1 (we use the same "icc" name as pngsave).
2022-09-28 16:28:44 +01:00
Kleis Auke Wolthuizen 4176ab2106
tiff2vips: avoid `g_assert_not_reached` in the default clause (#3064)
Since that could terminate the application in debug builds. Also,
add the missing case clause for `PHOTOMETRIC_MINISWHITE`.

Resolves: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51013.
2022-09-24 13:36:02 +01:00
Kleis Auke Wolthuizen db96adfc00
Ensure `--vips-config` only prints build configuration (#3062)
Also, remove a remnant of Autotools.
2022-09-24 11:26:30 +01:00
John Cupitt 5569022dbd use G_GNUC_* attribute system
Instead of our own compiler attr thing.

see https://github.com/libvips/libvips/issues/2871
2022-09-23 14:37:35 +01:00
John Cupitt eed0e5b43c Merge branch '8.13' 2022-09-22 14:11:31 +01:00
John Cupitt a86f33769b add changelog note 2022-09-22 14:09:55 +01:00
Ruven 33d44e86fb SubIFD offsets should only be added if smaller pyramid layers actually exist. Otherwise results in corrupted TIFF files for images smaller than the tile size (#3058) 2022-09-22 14:09:03 +01:00
Ruven cdf497d3e2
SubIFD offsets should only be added if smaller pyramid layers actually exist. Otherwise results in corrupted TIFF files for images smaller than the tile size (#3058) 2022-09-22 13:36:27 +01:00
John Cupitt 1f8e547d99 Merge branch '8.13' 2022-09-21 19:09:44 +01:00
Kleis Auke Wolthuizen e88e5f0d2a
text: simplify check for 32k pixel limit (#3057) 2022-09-21 19:06:49 +01:00
John Cupitt c9a21a7aaa Merge branch '8.13' 2022-09-21 11:50:16 +01:00
John Cupitt fa4b80b74b earlier quit of dzsave on kill
We were only testing "killed" once for each strip of tiles. Check on each
tile as well to make set_kill() faster.

see https://github.com/kleisauke/net-vips/issues/179
2022-09-21 11:48:48 +01:00
John Cupitt 75bd19759f Merge branch '8.13' 2022-09-20 10:04:22 +01:00
John Cupitt 907d17cd06 revise caching of seq mode loaders
We were not caching seq mode loaders used in random access mode.

see https://github.com/libvips/libvips/issues/3044
2022-09-20 10:03:00 +01:00
Kleis Auke Wolthuizen 6d43755bfa
convi/reducev: initialize the sum with the addition (#3052)
* reducev: initialize the sum with the addition

Avoids an Orc opcode.

* convi: initialize the sum with the addition

Avoids an Orc opcode.

* vector: add comments to magic numbers
2022-09-17 14:18:15 +01:00
Kleis Auke Wolthuizen d874010d09
convi/reducev: use convsuswb in Orc path (#3053)
* reducev: use convsuswb in Orc path

Saves a few instructions.

* convi: use convsuswb in Orc path

Saves a few instructions.
2022-09-17 12:26:00 +01:00
John Cupitt 3b33d912c4 fix an undefined shift 2022-09-15 12:57:36 +01:00
John Cupitt d2e7d036ae improve HEIF is_a
- fix sign issue with some chunk sizes
- allow larger chunk_len

See https://github.com/libvips/libvips/discussions/3048
2022-09-14 16:56:37 +01:00
Kleis Auke Wolthuizen 6bf1422548
jxlsave: sync quality to distance calculation with libjxl (#3050)
Ensures the quality to distance conversion is continuous at 30.

See:
ea5fa8074d
2022-09-14 13:40:40 +01:00
Ruven 4985fec6b4
Inverted order of TIFF tag writing when saving multi-page subifd pyramids (#3047)
* Inverted order of TIFF tag writing when saving multi-page subifd pyramids to ensure that subifd pyramid layers are correctly tagged as reduced-image subfile type and not as pages

* Use if-else clause to avoid tag overwriting
2022-09-13 17:56:42 +01:00
John Cupitt 3081821636 revert dhint check
We added a check that loader ->header() and ->load() methods set the
same dhint. This commit removes that check -- it's not possible to make
header and load match in all cases since images can take so many routes,
and can change between the two events.

If we see performance issues around inappropriate cache sizing again,
try to fix just those cases.
2022-09-12 10:38:17 +01:00
John Cupitt 0b3ab3a934 fix null string in buffer print
Some libvips header fields can be NULL, for example filename, and we
need to avoid null pointer deref on print.

See https://github.com/libvips/libvips/issues/3043
2022-09-11 14:29:12 +01:00
John Cupitt e37487ca2f fix null string in buffer print
Some libvips header fields can be NULL, for example filename, and we
need to avoid null pointer deref on print.

See https://github.com/libvips/libvips/issues/3043
2022-09-11 14:26:53 +01:00
Lovell Fuller c9de7b2b15
tiff2vips: ensure stdint.h in included for uint32_t (#3040) 2022-09-11 13:41:30 +01:00
Sergey Alexandrovich ce31c04cd2
nsgifload: choose tile-height based on page height (#2996) 2022-09-08 19:05:42 +01:00
Daniel Löbl 2d9c50735f
webpsave: switch to sink_disc (#3018)
* webpsave: switch to sink_disc

* fix some warnings

* distinguish between animated and single image write

* fix some formatting issues

* add missing comments

* fix webpsave_mime

* don't use sink_disc for single image webp write

* fix potential segv/double free

* update changelog

* remove leftover function declaration

* Revert "don't use sink_disc for single image webp write"

This reverts commit a75922ca93ee8987fa5e1ffc52b68e22bd6fb1fb.

* implement review feedback

* adjust to a column size of 80

* get contiguous RGB(A) buffer directly from VipsRegion

* Revert "get contiguous RGB(A) buffer directly from VipsRegion"

This reverts commit 84fc10e52fb223f0208c605dde92d3f821ceee0e.

* accumulate image data directly in frame_bytes buffer

* switch WebP back to Webp naming scheme

* rename page_index to page_number

* revise formatting
2022-09-08 14:32:13 +01:00
John Cupitt a36d382519 oop debug left on 2022-09-08 10:21:19 +01:00
John Cupitt c0e91d139d revise cgifsave to save mem
a bit simpler too

copying dloebl's idea from https://github.com/libvips/libvips/pull/3018
2022-09-08 10:16:50 +01:00
John Cupitt 5d1e26255d Merge branch '8.13' 2022-09-08 09:14:01 +01:00
Lovell Fuller b58b7bd416
pngsave: ensure 8-bit palette images can be created (#3031) 2022-09-08 09:10:02 +01:00
John Cupitt 3191e5cea5 revise cgif save loop 2022-09-07 12:10:20 +01:00
John Cupitt 91986a9778 revise cgif save loop 2022-09-07 11:10:02 +01:00
John Cupitt 5afc4a2df5 Merge branch '8.13' 2022-09-05 09:59:25 +01:00
Kleis Auke Wolthuizen e87c828aa5
dzsave: add missing include directive for errno/EEXIST (#3025)
Resolves: #3024.
2022-09-05 09:58:52 +01:00
John Cupitt 702ed8298f check for blocked operations on cache lookup
We could return an operation from cache even after the operatuion had
been blocked. This was harmless, but could cause confusion.

see https://github.com/kleisauke/wasm-vips/pull/24
2022-09-04 16:35:00 +01:00
John Cupitt 078ac059b7 update spngload for new header test 2022-09-03 22:42:41 +01:00
John Cupitt 19009b15a9 revise loader demand hints
Add a check that header and load methods agree on the demand hint, and
make sure all loaders pass.

If they disagree, you can get bad performance in some cases, since the
pipeline can be built from the header dhint.
2022-09-03 15:31:37 +01:00
John Cupitt a7e754162a
move tiff decompress outside lock (#2969)
* move tiff decompress outside lock

Most time in TIFF read is spent in decompression. If we move this
outside the lock, we can get a useful speedup.

This commit adds the machinery to move the lock to before decompress, so
jp2k decompression is now threaded.

Before:

```
$ vips copy wtc.jpg x.tif[tile,compression=jp2k]
$ time vips avg x.tif
117.249845
real	0m15.085s
user	0m16.155s
sys	0m0.109s
```

After:

```
$ time vips avg x.tif
117.249845
real	0m1.207s
user	0m18.384s
sys	0m0.369s
```

* start moving jpg decode outside the lock

* move jpeg decompress outside the lock

seems to work

* add some more tile size checks

double-check jpeg tile size before decode

* fix tiffload demand hinting

We were not setting the hint correctly in header load, and we were not
hinting smalltile for tiled TIFFs.
2022-09-03 13:10:58 +01:00
John Cupitt 9486110abb Merge branch '8.13' 2022-08-30 17:11:51 +01:00
Kleis Auke Wolthuizen a19f326d19
dzsave: improve compatibility with libgsf < 1.14.29 (#3017)
* Implement `GsfOutfileStdio` by ourselves

* Add missing `->root` init

* Fix styling

* Update ChangeLog
2022-08-30 17:10:38 +01:00
John Cupitt 6a154ac9f2 add ".pnm" save
see https://github.com/libvips/libvips/issues/3016
2022-08-30 12:31:47 +01:00
John Cupitt 2e5e9fb755 set "magick-format" for IM7 load
see https://github.com/libvips/libvips/discussions/3011
2022-08-26 16:01:15 +01:00
John Cupitt 4a85214c0e set magick-format
see https://github.com/libvips/libvips/discussions/3011
2022-08-26 15:53:01 +01:00
John Cupitt f4cd55ddf5 tweak popperload tile size
to make it big enough for an A4 page at 300dpi
2022-08-26 13:14:44 +01:00
Daniel Löbl 0b70145d99
cgifsave: add support for interlaced GIF write (#2984)
* cgifsave: add support for interlaced GIF write

note: cgif >= v0.3.0 is required

* switch to warning instead of error

* add test

* fix test
2022-08-15 12:14:02 +01:00
John Cupitt 0029b3c416 require libjxl 0.7+ 2022-08-14 17:32:40 +01:00
John Cupitt 332d3a9093 Merge branch '8.13' 2022-08-14 17:28:26 +01:00
John Cupitt e88db2ceb4 fix jxl load rewind
Looks like there's no way to reset the decoder state, so we have to
remake it.
2022-08-14 17:27:13 +01:00
John Cupitt 99e6bb833e ooops 2022-08-14 16:29:00 +01:00
Kleis Auke Wolthuizen f36196db1b
jxlsave: avoid using deprecated functions (#2989)
* jxlsave: avoid using deprecated functions

The upcoming libjxl 0.7 has deprecated a number of functions.

* Prefer to use `ifdef` instead
2022-08-14 15:54:21 +01:00
Kleis Auke Wolthuizen 34427d83a0
jxlsave: correctly mark frame as last (#2988)
It's required to close the input, otherwise the encoder can't
know what the last frame is, resulting in an improper codestream.

Resolves: #2987.
2022-08-14 15:53:33 +01:00
John Cupitt b4bfaeb980 Merge branch '8.13' 2022-08-14 12:16:10 +01:00
John Cupitt 1989203985 fix low bitdepth PNG save of high bitdepth images
SOme combinations of high bitdepth images with low bitdepth PNG save could
produce incorrect images, for example saving a 16-bit fourier image as 1-bit.
2022-08-14 12:14:55 +01:00
John Cupitt aa109f102d Merge branch '8.13' 2022-08-14 10:31:09 +01:00
John Cupitt ca2796aa7f fix low-bitdepth spng save
There was a missing shift, thanks jeffska

See https://github.com/libvips/libvips/issues/2985
2022-08-14 10:26:24 +01:00
John Cupitt c0637d9969 jp2ksave saves as jp2
Confusingly we previously saved jp2 images as a jpeg2000 codestream rather
than as a jp2 file.

See https://github.com/libvips/libvips/issues/2977
2022-08-11 16:49:40 +01:00
Felix Bünemann c6214b4d47
Remove even pixel check for J2K subsample_mode auto (#2975)
Having a different colorspace and chroma subsampling just because the
source image happens to be an even or odd number of pixels is surprising
and hard to debug, so let's remove it.
2022-08-11 16:02:03 +01:00
John Cupitt a928c9a885 a little more dbg output in heifsave 2022-08-11 10:30:23 +01:00
John Cupitt d27dfbe55d revise help text for loaders
Hopefully to make it clearer and more consistent.

See https://github.com/libvips/libvips/discussions/2982
2022-08-10 12:50:53 +01:00
John Cupitt 29e80ca43f better 0 detection in unpremultiply
We were avoiding /0 by testing for alpha==0, however, this will still
allow very small values of alpha to generate +/- Inf. Instead, check for
abs(alpha)<epsilon.

Fixes some artifacts after unpremul.
2022-08-08 16:16:10 +01:00
John Cupitt 0f56b099d0 remove dbg 2022-08-05 09:14:28 +01:00
John Cupitt 34c17fc3e8 don't minimise after sink_screen expose
We were minimising at the end of threadpool_run, but this was being
called for each sinkscreen render pass, so we were throwing away the
display cache.

Instead, minimise after sink, sink_memory and sink_disc.
2022-08-05 09:12:13 +01:00
John Cupitt 7e961b4671 Merge branch '8.13' 2022-08-02 14:22:27 +01:00
Kleis Auke Wolthuizen f43f7844a7
convf: bake the scale into the mask (#2974)
Similar to the vector path of vips_convi.
2022-08-02 14:21:07 +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
Kleis Auke Wolthuizen 4d5622c217
Simplify `VIPS_CONFIG` definition (#2964) 2022-07-30 19:23:09 +01:00
Kleis Auke Wolthuizen 3f95543c2c
Allow to modify/create EXIF GPS* tags (#2966)
* Allow to modify/create EXIF GPS* tags

Make `tag_is_ascii` aware of the EXIF GPS* ASCII tags that are
available since libexif 0.6.23.

See: https://github.com/lovell/sharp/issues/2767

* Add tests
2022-07-30 19:21:54 +01:00
John Cupitt d17fd9b640 fix matlab block test 2022-07-30 12:36:56 +01:00
Kleis Auke Wolthuizen cf97ea3ea1
Deduplicate `--vips-config` with the build summary (#2957)
* Deduplicate `--vips-config` with the build summary

* Ensure output is identical

Helps parses.
2022-07-29 11:09:51 +01:00
Kleis Auke Wolthuizen a24b556b26
Meson: simplify dynamic module handling (#2956) 2022-07-28 15:10:13 +01:00
Kleis Auke Wolthuizen 45bcd74a7a
Fix libpng fall-back when build with `-Dspng=disabled` (#2955) 2022-07-28 14:37:12 +01:00
Kleis Auke Wolthuizen 057703938e
Remove remnant of Autotools (#2950)
* Remove `glib-mkenums` autotools templates and generated files

Meson uses the `enumtypes.c.in` and `enumtypes.h.in` in
`libvips/include/vips` and doesn't use the pre-generated
files.

* Remove man files for no longer existing tools

+ update the `meson.build`.

* Remove Autotools section in `.gitignore`

* Remove `po/messages` left-over

* Remove `g-ir-scanner` entry point

No longer needed by Meson.

* Remove `glib-genmarshal` generated files

Meson doesn't use these pre-generated files.

* Remove Autotools specific Git attributes

* Remove no longer existing tools in `.gitignore`

* Remove Make specific things in `.gitignore`

* Rename COPYING to LICENSE

* Remove no longer needed `.gitignore` sections

Meson only supports out-of-tree builds. This assumes that the
build directory is ignored.

* Remove no longer needed `.editorconfig` sections
2022-07-27 10:56:56 +01:00
Kleis Auke Wolthuizen b808cba14a
Remove unneeded adapter function for Emscripten (#2949)
The `*_class_intern_init` functions have already been patched within
wasm-vips to include the missing `class_data` member, so this adapter
function was not needed.
2022-07-27 09:14:12 +01:00
John Cupitt 95970d0f40 ignore TAGS 2022-07-27 09:11:01 +01:00
John Cupitt d3021c2775 Merge branch '8.13' 2022-07-27 09:09:12 +01:00
John Cupitt 538aa2a841
remove autotools (#2941)
* remove autotools

It seems to all work. I tested with gtk-doc enabled. I probably missed a
few things argh.

* oop, forgot m4/
2022-07-24 11:14:52 +01:00
Kleis Auke Wolthuizen 7010903538
Meson: improve summary table (#2943)
* Meson: improve summary table

* Fix typo

* Remove redundant whitespace
2022-07-24 11:06:40 +01:00
Kleis Auke Wolthuizen e93f56c8bb
Simplify/modernize `vips_crop_get_type()` (#2940) 2022-07-23 10:14:03 +01:00
Kleis Auke Wolthuizen a498680094
Update `glib-mkenums` templates (#2939)
* Avoid writing the full path in enumtypes.h

Helps reproducible builds, as build paths can vary between builds.

* Use g_intern_static_string() for enum/flags type names

We are emitting a static string, so use that shortcut function to
intern it, which will save one allocation.

* Use g_once_init_enter/leave to register enum/flags type names

This is the more modern way, and ensures thread-safety.
2022-07-22 15:33:40 +01:00
Kleis Auke Wolthuizen fa6c034b32
Link the main library with `-Wl,-z,nodelete` to prevent unloading (#2934)
See: https://github.com/libvips/php-vips-ext/pull/44
2022-07-20 10:20:09 +01:00
John Cupitt 57fff0fe2b don't check ADLER32 checksums on libpng load
can be rather chatty, and even cause loops on some libpng versions

see https://github.com/libvips/libvips/discussions/2930
2022-07-16 17:18:39 +01:00
Kleis Auke Wolthuizen d546c81fa3
Fix `dzsave_target` for ZIP output (#2927) 2022-07-15 19:39:56 +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
Kleis Auke Wolthuizen e1098857b3
svgload: use `rsvg_handle_get_geometry_for_element` instead (#2919)
See: https://gitlab.gnome.org/GNOME/librsvg/-/issues/853.
2022-07-12 12:33:54 +01:00
John Cupitt 8a049e9dfc fix RGBA_ONLY with generic mono
1. Convert MULTIBAND uint/short/etc. as we convert uint8 images. They
   are probably just uint8 that have been cast up in format.

2. Don't check that the image interpretation is a supported colourspace
   before calling vips_colourspace() ... we want to fail with an error
   if it can't be converted, not silently accept the image.
2022-07-10 19:32:14 +01:00
John Cupitt 0971344785 improve behaviour of pipelines with seq sources
Loaders which supported random access would not set the seq flag even if
seq mode was requested.

This would make operations like shrinkv to not run in seq mode, causing
massive cache thrashing.

See https://github.com/libvips/libvips/discussions/2898
2022-06-29 17:54:20 +01:00
Kleis Auke Wolthuizen f28e3f1e36
Remove stray soname.h (#2893)
This became obsolete after commit f11b58ff.
2022-06-26 18:59:32 +01:00
Kleis Auke Wolthuizen ae831a145e
Cleanup .gitignore (#2889)
* Cleanup .gitignore

* Re-add `patches` directory to `Makefile.am`

And ensure it's being tracked by git.
2022-06-23 16:36:47 +01:00
John Cupitt e81f7f1fab fix stray jp2k save message
we had a stray "valid clipped" message
2022-06-23 10:31:36 +01:00