Commit Graph

8153 Commits

Author SHA1 Message Date
Kleis Auke Wolthuizen aef030e78a
cplusplus: add missing argc check in resize example (#3200) 2022-11-30 00:04:27 +00:00
Emanuel Jöbstl 25444cd927
Expose attention center when doing attention-based cropping. (#3164)
* ADded optional output parameter to smartcrop to track the center of
attention.

* Added unit test.

* Added docs & updated changelog.

* Updated argument labels & types in documentation.
2022-11-28 14:10:16 +00:00
John Cupitt 697311bc9f typo 2022-11-28 10:29:47 +00:00
John Cupitt cbfbeb6e2d don't parse floats with scanf
since scanf uses the current locale, duh

see https://github.com/libvips/libvips/issues/3191
2022-11-28 08:51:13 +00:00
Kleis Auke Wolthuizen 4611651d90
nsgifload: avoid minimise after mapping (#3189)
* nsgifload: avoid minimise after mapping

Not reliable on Windows.

* nsgifload: prefer use of `VIPS_FREEF` macro

* Improve `test_descriptors.c`

* Only build `test_descriptors` when targeting Linux
2022-11-27 15:43:35 +00:00
Kleis Auke Wolthuizen 1040766b04
dzsave: add error handling for `vips_gsf_path()` (#3188)
It can return `NULL` when it exceeds the path limits.

See: https://github.com/kleisauke/net-vips/issues/184
2022-11-27 15:30:04 +00:00
John Cupitt 5947f6ed11 fix a compiler warning 2022-11-21 16:53:15 +00:00
John Cupitt e3289ad2c1
add exif support to png load/save (#3168)
* start adding exif in png

the "Exif\0\0" header isn't being added and removed correctly

needs tests

* all done

tested with linpng and libspng
2022-11-18 11:57:05 +00:00
André Pedersen ef1300a288
fixed 'lossless" typo (#3169) 2022-11-18 11:56:27 +00:00
Kleis Auke Wolthuizen 567c44e2ec
jxlload: simplify rewinding (#3170)
This partially reverts commit e88db2ce.
2022-11-18 11:55:55 +00:00
John Cupitt e24cee4e22
WIP -- add simple bash completion support (#3131)
* add simple bash completion support

* add "completions" subdir to meson

* start extending completion to extra args

* file complete for every arg after 1

* add completion for enums, file, ints, doubles

* docs, try to improve directory completion

though dir completion is not working correctly, I'm not sure why
2022-11-13 18:57:14 +00:00
John Cupitt 7f352b3c9e
revise fitsload (#3120)
* compiles

* note changelog

and switch to FATSTRIP (much quicker)

* don't duplicate header fields in fitssave

be careful not to set records twice in save

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

* tiny polish
2022-11-13 18:52:28 +00:00
John Cupitt ef2646ef6a
add a "wrap" option to vips_text() (#3130)
see:

https://github.com/libvips/libvips/discussions/2073

https://github.com/libvips/libvips/discussions/3126
2022-11-10 15:46:46 +00:00
John Cupitt 144834a6aa replace memcpy() in d180 with a loop
thanks alantudyk

see https://github.com/libvips/libvips/issues/3149#issuecomment-1309405404
2022-11-10 04:45:50 +00:00
John Cupitt b8a2d26ad9 Merge branch '8.13' 2022-11-09 14:53:43 +00:00
John Cupitt 27874386b2 missing include in mosaic_fuzzer
causes build fail on debian9, see https://github.com/libvips/libvips/issues/3152
2022-11-09 14:52:01 +00:00
John Cupitt 557fc76634 faster gif save if interpalette-maxerror is huge
If interpalette-maxerror is very large, we don't need to recompute the
palette for every frame, since we'll never choose a new palette.
2022-11-07 16:49:12 +00:00
John Cupitt 3ebb21491d improve fail-on handling for GIF load
fail-on truncated and warning now works for GIF load
2022-11-05 12:04:47 +00:00
Michael Drake b32bc70de7
libnsgif: Update to latest upstream (#3142)
Allows clients to know if the scan encountered a truncated image.
2022-11-05 11:16:23 +00:00
Michael Drake 2189e49dc7
Update to latest upstream libnsgif and call nsgif_data_complete (#3141)
* libnsgif: update script: Fix to handle dir with no patches

* libnsgif: Update to latest upstream

Fixes loading of broken gifs with truncated final frame.

* nsgifload: Call nsgif_data_complete after data scan

This allows libnsgif to distinguish between awaiting more
data, and a broken truncated GIF. In the latter case we
can display what we have.
2022-11-05 04:14:45 +00:00
John Cupitt 3d29daf553 block use of RGB profiles with CMYK images
Detect and block a common error.

See https://github.com/libvips/libvips/issues/3139
2022-11-03 14:18:38 +00:00
John Cupitt 17ca29adc9 tiny formatting fixes 2022-10-27 17:54:09 +01:00
John Cupitt 976db37f84
Revised threading system (#3105)
* reimplement threadpool

just a set of threads that get recycled

"ninja test" passes and dzsave seems to work, though pytest fails for
some reason

* clean up threading code a bit

move base stuff into thread.c, so we have a simple

	thread -> threadset -> threadpool

layering

* start trying to revert g_threadpool

based on the original commit

* working!

nice low systime again

still need to repply cnages to threadpool.c since 80e0cc3d1

* reapply fixes from master

so threadpool.c is now up to date

* rename VipsThread as VipsWorker

a bit less confusing

* use a semaphore to count workers in a pool

* tidy up

* formatting

* dynamic threadpool sizing

based on counting the number of blocked threads in each pool

it works, but the improvement is not great :(

* add "concurrency" metadata item

so operators can hint threadpool size (dzsave especially)

* don't use thinstrip for small images

* add RGB mode to openslide

since flatten was taking 20% of CPU time for dzsave

* fix up rgb mode

now actually works

* make the tile buffer per thread

in the new openslideload rgb mode

* fix dynamic pool downsize

* mild refactoring

* fix the buffer system

oops, turned it off by mistake

* all done!

* revise changelog

* Update libvips/iofuncs/threadset.c

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

* Update libvips/iofuncs/threadset.c

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

* LSan: add libMagickCore to suppression file

* Revert "Remove mutex lock for VipsThreadStartFn"

This reverts commit 41440491.

* add VIPS_MAX_THREADS

to set a hard limit on the threadset size

* Revert "Revert "Remove mutex lock for VipsThreadStartFn""

This reverts commit 77e8520966ba79194fff3b4e648bbd295cd5c260.

* remove sslock from sink.c

* move fixed threadpool build to init

not first use

* add some doc comments

* revert test suite threshold change

* add a test for MAX_THREADS

and move the test tmp/ area into the builddir

* limit VIPS_MAX_THREADS to sane values

* use tabs rather than spaces

Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2022-10-26 15:25:19 +01:00
Lovell Fuller c76d74be65
Ensure EXIF is at least 4 bytes before inspection (#3109) 2022-10-22 11:20:53 +01:00
Kleis Auke Wolthuizen ea0912f23b
Fix build with `-Dwebp=disabled` (#3106) 2022-10-20 10:34:08 +01:00
Eli Schwartz e73f003d33
skip some skippable tests (#3102)
* tests: consolidate redundant, duplicated helper code

These functions currently exist in a sourced shell library, but there is
an identical copy of them in a single test file. Get rid of this
duplicate definition.

* tests: mark some tests as skipped if bc is not installed

`exit 77` is the GNU exitcode protocol for tests that cannot be run
because their prerequisites are not available. If `bc` is not installed,
and it often isn't, the test can be short-circuited instead of failing;
meson will report them in "warning yellow".

* tests: mark some tests as skipped if support is not compiled

Not all test cases can be cleanly marked as skipped -- sometimes,
multiple things are checked, and having one be unavailable should not
mean skipping all tests.

But in a couple cases, a test file only tests one thing, and that may be
skipped. In such cases, it can be semantically indicated in the test
harness report collection, that a skip occurred.
2022-10-19 18:13:48 +01:00
John Cupitt eb4b21eec2 Merge branch '8.13' 2022-10-19 17:37:11 +01:00
John Cupitt 53a3e6d819 note recent changes 2022-10-19 17:36:55 +01:00
John Cupitt e33796d752 Merge branch '8.13' 2022-10-19 17:35:36 +01:00
Sergey Alexandrovich 982a835eed
spngsave: Don't shift indexed pixels (#3101) 2022-10-19 17:34:43 +01:00
Kleis Auke Wolthuizen e6198361e5
thumbnail: fix embedded ICC profile conversion (#3027) 2022-10-19 17:32:04 +01:00
John Cupitt 2335172794 Merge branch '8.13' 2022-10-19 12:47:53 +01:00
Lovell Fuller 1fc01c05e8
exif: ensure prefix is present before parsing (#3100)
Newer Apple devices are creating EXIF without this however libexif
still requires it due to JPEG/JFIF/APP1 marker heritage.
2022-10-19 12:47:23 +01:00
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 c8a88c618b Merge branch 'master' of github.com:libvips/libvips 2022-10-19 09:13:50 +01:00
John Cupitt 0936ef6c29 clarify readme a little 2022-10-19 09:12:12 +01:00
Kleis Auke Wolthuizen 67c642e5ec
CI: various improvements (#3096)
* CI: upgrade macOS runner to version 12 (Monterey)

* CI: upgrade actions/checkout to v3

* CI: remove retry logic for apt

The Linux runners on GitHub Actions already retries up to 10 times,
see:
6c93c24107/images/linux/scripts/base/apt.sh (L11-L12)

* CI: remove redundant `DEBIAN_FRONTEND=noninteractive` env

The Linux runners on GitHub Actions already sets this env variable,
see:
6c93c24107/images/linux/scripts/installers/dpkg-config.sh (L10)

* CI: remove redundant `HOMEBREW_NO_AUTO_UPDATE=1` env

The macOS runners on GitHub Actions already sets this env variable,
see:
6c93c24107/images/macos/provision/configuration/environment/bashrc (L26)

* CI: prefer shorthand flag of apt-get `--fix-missing`

* CI: install libjxl on macOS runner

* Update test suite's README.md
2022-10-17 19:08:35 +01:00
John Cupitt f0bb3e3442 Merge branch '8.13' 2022-10-14 20:06:34 +01:00
John Cupitt e83468e051 note spng fixes 2022-10-14 20:06:05 +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
John Cupitt 7547476f44 version bump 2022-10-11 08:45:16 +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
Kirk Martinez df9f5d38f8
copied invert example into examples (#3069)
* simple invert example

* Update meson.build
2022-09-29 11:48:24 +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