Commit Graph

5705 Commits

Author SHA1 Message Date
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
John Cupitt 748a99d245 reorder Target struct to improve compat
so fields are at the same position at least

see https://github.com/libvips/libvips/issues/2880
2022-06-21 19:07:35 +01:00
John Cupitt 16e0182e52 fix dzsave_target on older libgsf
Older libgsf needs TRUE back from the GsfOutput seek method.

see https://github.com/libvips/libvips/issues/2878
2022-06-21 18:00:07 +01:00
John Cupitt d9f31be67d configure should add meson files to make dist
add meson.build etc. to EXTRA_DIST

see https://github.com/libvips/libvips/issues/2876
2022-06-20 15:04:33 +01:00
John Cupitt e9414f8d8f fix build with older libgsf
build on libgsf without zip64 support was broken, thanks @remicollet

see https://github.com/libvips/libvips/issues/2878
2022-06-20 13:19:35 +01:00
John Cupitt a129476f0f fix "make dist" ready for 8.13 rc1 2022-06-19 16:20:30 +01:00
John Cupitt 01d5fbd6a4 use a contiguious buffer for the frame
fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=48021
2022-06-19 12:57:47 +01:00
John Cupitt 89615465b7 avoid size_t pixel counts in cgifsave
since we limit frame size to INT_SIZE / 4
2022-06-19 12:26:02 +01:00
Daniel Löbl 905a6fe79f
cgifsave: limit max number of colours to 255 (#2863)
* cgifsave: limit max number of colours to 255

* switch to VIPS_MIN
2022-06-19 12:16:03 +01:00
Sergey Alexandrovich 41da0d28e0
cgifsave: remove regressions from 2853 (#2870)
* cgifsave: pick the best quantizer instead of the first good enough

* cgifsave: fix palettes comparison

* cgifsave: don't copy unchanged pixels to previous_frame
2022-06-19 12:15:40 +01:00
Kleis Auke Wolthuizen 5b79a744a7
thumbnail: avoid upsizing via libwebp (#2874) 2022-06-19 12:02:00 +01:00
John Cupitt c61b458904 add jxlsave tests
and revise colour encoding set

see https://github.com/libvips/libvips/issues/2872
2022-06-18 16:40:10 +01:00
John Cupitt 156e6a91e4 try to improve jxl lossless, again
now seems to handle scrgb and srgb, lossless and lossy, with and without
an ICC profile

see https://github.com/libvips/libvips/issues/2872
2022-06-18 16:01:51 +01:00
John Cupitt e0b5eeecde Merge branch 'master' of github.com:libvips/libvips 2022-06-14 12:08:20 +01:00
John Cupitt 5ef16188ca display blocked/untrusted status in vips -l
though only for loaders/savers
2022-06-14 12:06:41 +01:00
Kleis Auke Wolthuizen 8c7576a5fe
cgifsave: reject images that exceed the pixel limit of libimagequant (#2865) 2022-06-14 10:23:11 +01:00
John Cupitt a7697b462f use size_t for GIF n_pels
fixes an overflow, thanks Kleis
2022-06-13 14:25:39 +01:00
Kleis Auke Wolthuizen ebfef68707
cgifsave: fix stack-use-after-scope (#2862)
By reusing `cgif->palette_rgb`, this ensures that `pLocalPalette`
doesn't become indeterminate when it reaches `cgif_addframe`.
2022-06-13 12:59:40 +01:00
John Cupitt 48d13f4828 oop, left some DEBUG on 2022-06-13 10:27:42 +01:00
John Cupitt 9f3860ec22 fix up scrgb support in JXL
after some discussion on discord with the libjxl maintainers

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

to do: save scrgb to eg. JPEG fails right now :( we need to do
scRGB->sRGB in jpegsave
2022-06-12 16:43:26 +01:00
Kleis Auke Wolthuizen 7553f60aed
Minor cleanups (#2857)
- Remove `HAVE_LCMS` definition in favor of `HAVE_LCMS2`.
- Remove `HAVE_WINDOWS_H` definition in favor of `G_OS_WIN32`.
- Remove stray `vips_text_get_type` in `conversion.c`.
- Remove duplicated `unistd.h` include.
- Remove redundant `strcasecmp` definition, we use `g_ascii_strcasecmp` everywhere.
- Remove unnecessary header checks in `configure.ac` and `meson.build`.
- Ensure `unistd.h` include is guarded with `HAVE_UNISTD_H`.
- Fail early when `-Dfontconfig=enabled` and `pangoft2` is not found.
2022-06-12 12:22:36 +01:00
John Cupitt 7fbdb01fb9
try to make cgifsave easier to read (#2853)
* try to make cgifsave easier to read

and fix a few memory errors

* move another loop out of write_frame

slightly smaller
2022-06-12 11:25:32 +01:00
Kleis Auke Wolthuizen 296c263099
Meson: maintain autotools compatibility on macOS (#2856)
By setting the correct compatibility/current version.
2022-06-11 22:54:43 +01:00
Kleis Auke Wolthuizen cdf12dd849
Mark Poppler as untrusted (#2855) 2022-06-11 16:25:28 +01:00
Kleis Auke Wolthuizen 1214f942f9
Prefer to use `flags |=` everywhere (#2854)
Use the bitwise OR assignment operator to ensure that derived
classes does not overwrite the flags from the base class. Also,
move the flags from `openslideload_source` to its base class.
2022-06-11 15:40:39 +01:00
John Cupitt c7baa4535a cleaner blocking code
thanks kleis!
2022-06-11 15:37:27 +01:00
John Cupitt 399fba2124 fix error in prev commit 2022-06-11 14:03:45 +01:00
John Cupitt 8bf90ed44e fix BLOCK_UNTRUSTED after previous commit 2022-06-11 12:38:43 +01:00
John Cupitt bd65ddda66 fix operation_block_set
kleis discovered that it needs a full class name, and found a missing
"*"
2022-06-11 11:41:03 +01:00
Kleis Auke Wolthuizen bae0342d95
Update C++ binding and function list (#2851)
* Update C++ binding and function list

Also, start with a capital letter in descriptions whenever possible.

* Ensure `dzsave_target` is generated
2022-06-10 14:43:44 +01:00
Kleis Auke Wolthuizen 45a99238e2
text: use MT-safe `pango_cairo_font_map_get_default` (#2848)
* text: use MT-safe `pango_cairo_font_map_get_default`

* Increase minimum Pango version to v1.32.6 (released Jan 2013)
2022-06-08 16:06:45 +01:00
John Cupitt b086b3f61a tiny formatting changes
and we can remove a vips__quantise_get_palette()
2022-06-08 15:43:28 +01:00
Sergey Alexandrovich 19bef959d1
cgifsave: palette change POC (#2824)
* cgifsave: compare palettes instead of frame sum

* Add vips__quantise_image_quantize_fixed function
2022-06-08 15:27:29 +01:00
Kleis Auke Wolthuizen 5106e9b49e
text: ensure fontconfig cache of Pango is invalidated (#2847)
See: https://gitlab.gnome.org/GNOME/pango/-/issues/551
2022-06-08 15:20:19 +01:00
John Cupitt 2d0c6b364c improve scaling of SVG images
We were not scaling images with fixed absolute dimensions.
2022-06-06 12:08:43 +01:00
John Cupitt 586fb31550 switch svgload to random access
and fix up pdfload random access
2022-06-05 15:57:43 +01:00
Sergey Alexandrovich 4fab8beae9
cgifsave: theshold alpha and check alpha constraint in one pass (#2827)
* cgifsave: theshold alpha and check alpha constraint in one pass

* cgifsave: get rid of sqrt()
2022-06-03 18:49:03 +01:00
John Cupitt cb1927e1b7 make C and vector path for composite match
one was <, one was <= for HARD_LIGHT
no effect on result, but it's better if they are consistent
2022-06-03 16:15:51 +01:00
John Cupitt af23e9f06c tiny formatting fixes 2022-06-01 12:33:43 +01:00
Sergey Alexandrovich c9b5b8c197
nsgifload: add "palette-bit-depth" header (#2828) 2022-06-01 12:27:10 +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
John Cupitt 2af2ca5ca2 add note about palette sorting by quantisers 2022-05-26 17:41:51 +01:00
Kleis Auke Wolthuizen 550781cd18
spngsave: fix 8bpp palette save with transparency (#2808) 2022-05-26 17:26:26 +01:00
John Cupitt 7121f952d5 revise formatting 2022-05-26 17:25:16 +01:00
Sergey Alexandrovich ba04c5f03f
cgifsave: fill transparent pixels with zeroes (#2823) 2022-05-26 17:23:04 +01:00
John Cupitt 111eef0049 lock progress to 100% on posteval
Because signals can be delayed, progress isn't always 100% in posteval.
Lock it to 100%.

See https://github.com/libvips/libvips/issues/2820
2022-05-23 19:27:40 +01:00
John Cupitt a9bfd508f5 revise cgifsave checksum
We were calling it a sum and looking for a change threshold, but really
it's only useful as a checksum and does not have a magnitude. Revise
comments and variable names to reflect this.
2022-05-23 13:17:20 +01:00
John Cupitt 89bbb7981d oop dbg left on 2022-05-23 13:07:38 +01:00
John Cupitt 63962056f0 small formatting fixes 2022-05-23 13:02:44 +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 7d3aaf540c small formatting 2022-05-23 12:42:26 +01:00
John Cupitt 047bef50d9 fix spngsave conversion
It was all mixed up. We don't need to call colourspace -- this is done
for us by the SAVEABLE system.

Fixes "vips identity x.png" error, see:

https://github.com/libvips/libvips/pull/2808#issuecomment-1133947162
2022-05-23 11:51:54 +01:00
Kleis Auke Wolthuizen 85c24481be
svgload: recognize dimensions for SVGs without width/height (#2817)
Rather than defaulting to 1928x1080. Also, prefer to use the
`LIBRSVG_CHECK_VERSION` macro instead of our configure checks.
2022-05-23 10:39:53 +01:00
John Cupitt 111f1d11df improve the interpretation sanity checker
it was rejecting int LABS
2022-05-22 14:05:01 +01:00
John Cupitt fd495bcd0a fix typo in tatrgetcustom.c
see https://github.com/libvips/libvips/pull/2802#pullrequestreview-980832505
2022-05-21 17:30:55 +01:00
Lovell Fuller c1f6995256
Pass close-on-exec flag to lcms for non-Windows OS (#2816)
This ensures child processes do not inherit open file descriptors
and will close a small but long-standing bug reported against
sharp over five years ago.

The change to lcms2 to support this is backwards compatible so
the flag will be ignored by existing versions.

The fopen 'e' flag will soon be part of the POSIX standard, and
is already supported in Linux and BSD. macOS currently ignores
it but will add support soon. Only Windows has a problem with it,
hence the ifdef wrapper.
2022-05-21 17:28:40 +01:00
John Cupitt 2ef1b198fb fix deprecation warning 2022-05-21 12:43:57 +01:00
John Cupitt bf614530cd use vips__bgra2rgba() in pdfiumload
slightly quicker, works with any byte order
2022-05-21 10:32:23 +01:00
Sergey Alexandrovich 985fb1d1d0
Don't paint the background if the PDF has transparency (#2804) 2022-05-21 10:17:44 +01:00
Lovell Fuller 7d4cba101c
jxl: remove support for never-implemented JXL_TYPE_UINT32 (#2813) 2022-05-21 09:49:31 +01:00
Lovell Fuller f9ace1724e
Fix a couple of typos in help messages (#2814) 2022-05-21 09:47:51 +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
Kleis Auke Wolthuizen 6aca41d713
quantise: fix styling (#2807)
Also, use the correct conditional directive in spngsave.
2022-05-20 14:31:16 +01:00
John Cupitt c5ea747f71 Merge branch 'master' of github.com:libvips/libvips 2022-05-18 10:57:56 +01:00
John Cupitt e42d2b46b9 revise SVG scaling, again
we were not defaulting width and height correctly

see https://github.com/lovell/sharp/pull/3230
2022-05-18 10:55:41 +01:00
Kleis Auke Wolthuizen f1b4b0cb1a
Swap size_t with gint64 to catch read errors (#2811)
This is similar to commit 5221df224f.
2022-05-17 22:04:20 +01:00
John Cupitt 5f82491d74 small configure improvements
- disable deprecated warnings for /deprecated
- detect librsvg rsvg_handle_get_intrinsic_size_in_pixels()
- tiny comment typo in meson.build
2022-05-16 14:45:53 +01:00
John Cupitt 793d3116a7 Merge branch 'master' of github.com:libvips/libvips 2022-05-16 14:30:41 +01:00
John Cupitt aa5abf3e7e fix background byte ordering in PDF
the `background` param was BGRA rather than vips-style RGBA

see https://github.com/libvips/libvips/pull/2804
2022-05-16 14:28:53 +01:00
Sergey Alexandrovich 982cbe5f8a
Don't fail if PNG contains too much text chunks (#2803)
Only warn if PNG contains too many text chunks

Update spngload.c
2022-05-15 12:18:06 +01:00
John Cupitt 7561d4e52c add libnsgif COPYING
oops, we were missing the COPYING file

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

thanks mika-fischer
2022-05-12 09:48:58 +01:00
John Cupitt 5221df224f fix ssize_t / ssize_t confusion 2022-05-11 22:28:34 +01:00
Kleis Auke Wolthuizen 9cbc361269
Allow to modify/create EXIF OffsetTime* tags (#2796)
Available since libexif 0.6.23.
2022-05-10 13:26:09 +01:00
Lovell Fuller 7e64c48ca9
heifsave: allow creation of EXIF metadata (#2794)
Previously only update of input EXIF was possible
2022-05-10 08:14:53 +01:00
Kleis Auke Wolthuizen d91cfa4e53
Allow to modify/create EXIF 2.3 ASCII tags (#2795)
* Allow to modify/create EXIF 2.3 ASCII tags

Make `tag_is_ascii` aware of the EXIF 2.3 ASCII tags that are
available since libexif 0.6.22.

See: https://github.com/kleisauke/net-vips/issues/167

* Fix CI
2022-05-10 08:13:22 +01:00
Michael Drake ceaa2d2096
Update LibNSGIF to latest upstream (#2791)
* libnsgif: Update to latest upstream

* nsgifload: Add palette info to debug output.
2022-05-09 10:20:57 +01:00
John Cupitt 460a19b78e revise arg names
use _ everywhere (we have a few uses of - as a separator)
2022-05-07 14:50:05 +01:00
John Cupitt cdcafbc4c5 add changelog notes
and linewrap for 80 column limit
2022-05-07 12:51:58 +01:00
Kleis Auke Wolthuizen 894ed1cb13
Resize improvements; add `ceil` and `gap` options (#1769)
* Add a round-up option to shrink

* Only leave the final 200% to reduce

* Add gap option to reduce and resize

* Add unit tests

* Incorporate feedback
2022-05-07 12:45:38 +01:00
Daniel Löbl cb55fdcfd8
allow to apply maxerror optimization to frames with alpha channel (#2778) 2022-05-07 12:16:13 +01:00
John Cupitt 20fd8ac0fc support rsvg_handle_get_intrinsic_size_in_pixels
librsvg 2.52+ has this new bit of API for finding the SVG dimensions
2022-04-28 13:01:17 +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 94d8a7d993 tried (and failed) to build against ubuntu nifti
the ubuntu cmake dev files for nifti seem to be broken, and I can't get meson
to add the dependency manually
2022-04-18 15:13:55 +01:00
Kleis Auke Wolthuizen 07edfe37b1
Improve symbol visibility (#2688)
* Improve symbol visibility

* Decorate required internal symbols with VIPS_API

* Remove a couple of stray header decls

* Incorporate review comment

- Ensure symbol visibility is also set on static libraries.
- Prefer to use `cc.has_function_attribute('visibility:hidden')`.

* Don't export internal deprecated symbols

* Move deprecated symbols to vips7compat.h

* `IM_FORMAT_H` -> `VIPS_FORMAT_H`

* Move `vips_window_ref` compat stub to `vips7compat.c`

* Disable deprecation warnings internally

* `vips_image_get_kill` -> `vips_image_iskilled`

* Ensure API compatibility

* Add missing include directives

* Move `vips__init` decl to vips7compat

* Move `vips__get_sizeof_vipsobject` to vips7compat

* Fix introspection build

* Fix 2 introspection warnings

* Ensure compatibility with vipsdisp

/usr/bin/ld: tilesource.o: in function `tile_source_new_from_source':
vipsdisp/tilesource.c:1627: undefined reference to `vips__region_no_ownership'
2022-04-16 10:58:55 +01:00
Michael Drake 0c3092fa94
libnsgif: Update to latest upstream (#2766)
That's great! Thank you for doing this, Michael.
2022-04-15 18:23:56 +01:00
John Cupitt 55723a980f add a seq to thumbnail_image
otherwise we can get horrible cache thrashing as the shrink will run
without any locality
2022-04-14 10:37:17 +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 6eae6fcf4b stop strip tiff read using tiny tiles
Strip TIFFs with rowperstrip of 1 used to use 1-pixel high cache tiles.
This could slow reading. This patch sets a minimum tile height near 16
but a multiple of the strip size.
2022-04-09 16:38:47 +01:00
Kleis Auke Wolthuizen 6c03343581
Add comments to `setjmp` invocations (#2751)
Also, pre-increment `num_warnings` to ensure that we really stop
at 100 warnings.
2022-04-06 12:01:18 +01:00
John Cupitt 57cd94278a revise interpretation guesser
This patch pushes the new pyvips interpretation guess rules down into
libvips.

See https://github.com/libvips/pyvips/pull/316
2022-04-05 18:32:25 +01:00
Kleis Auke Wolthuizen df26bd1e46 Stop JPEG load after 100 warnings (#2749)
See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24383
2022-04-05 11:07:29 +02:00
John Cupitt 2dc319b1b1 Revert "stop JPEG load after 20 warnings"
This reverts commit 89bd46d1c4.
2022-04-05 08:34:45 +01:00
John Cupitt 1aebd95387 Revert "improve fail on too many warings"
This reverts commit ae7e5e7a54.
2022-04-05 08:34:20 +01:00
John Cupitt ae7e5e7a54 improve fail on too many warings
thanks lovell, see 89bd46d1c4 (commitcomment-70409015)
2022-04-04 15:44:37 +01:00
Michael Drake 0f30690360
Update to latest libnsgif (#2747)
* libnsgif: Update to latest upstream.

* nsgifload: Update for new pixel format API.

LibNSGIF now lets the client select a pixel colour component
order. We use NSGIF_BITMAP_FMT_R8G8B8A8, which is the same
format LibNSGIF always decoded to.

* nsgifload: Remove loop_count from VERBOSE output.

This was internal state for a nsgif_frame_prepare() managed
animation, but VIPS doesn't use nsgif_frame_prepare(). The
loop_count member has been removed from the public structure.
2022-04-04 13:57:20 +01:00
John Cupitt 89bd46d1c4 stop JPEG load after 20 warnings
mitigates some DoS attacks somewhat

see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24383
2022-04-03 19:21:06 +01:00