Commit Graph

98 Commits

Author SHA1 Message Date
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 0337c09700
Cleanup gettext handling (#2695)
Use GLib's i18n support instead of copying and pasting that
logic into its own header. This deprecates the vips/intl.h
header in favour of glib/gi18n.h.
2022-02-27 15:27:28 +00:00
Kleis Auke Wolthuizen f92069b035
Incorporate #2506 also in {webp,magick7}load (#2507) 2021-11-01 18:33:27 +00:00
John Cupitt 1f321d366b disable webp shrink-on-load if it will judder
Webp decode can only shrink-on-load to int boundaries. This means that frames
in an animation which only update part of the canvas can get displaced by
up to 0.5 pixels, causing juddering.

see https://github.com/libvips/libvips/issues/2379
2021-10-27 13:25:04 +01:00
John Cupitt 757d031005 always check the return of vips_image_pipeline()
For consistency. Although I don't think it can meaningfully fail.
2021-06-29 16:12:17 +01:00
John Cupitt 0d7dd3be7c limit jxlload image size
We were not checking the reported image size against VIPS_MAX_COORD,
leading to some glib out-of-range errors downstream.
2021-05-08 15:25:53 +01:00
Lovell Fuller 45fd740130 webpload: prevent divide-by-zero when blending pixels
Adds a test case to prevent regression - see commit 6eaf1ed
2020-12-17 20:23:06 +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
Lovell Fuller f9dc3177c7 webpload: ensure first frame is not blended 2020-12-04 11:50:58 +00:00
John Cupitt 0131d4d3eb fix vips7 webp load
webp load using the vips7 interface was crashing, thanks barryspearce

see https://github.com/libvips/libvips/issues/1860
2020-10-19 14:34:02 +01:00
John Cupitt 213533e03c better webp load sanity checking
see d93d9bb43b (r40846309)
2020-07-23 15:46:53 +01:00
John Cupitt d93d9bb43b fix large animated web support
we were not checking image bounds correctly for very large animated webp
images

thanks pomirleanu

see https://github.com/libvips/libvips/issues/1730
2020-07-20 14:59:36 +01:00
John Cupitt 63d54e5df2 final code cleanups after stream -> source rename 2019-12-30 14:23:51 +00:00
John Cupitt 4c5873809f experiment with renaming stream
rename as VipsConnection, VipsSource, VipsTarget etc.

see https://github.com/libvips/libvips/issues/1494#issuecomment-569498619

renamed with this script:

```

set -e

edit() {
        sed -i -E "$1" rename
}

for i in $*; do
        cp $i rename

        edit s/VIPS_STREAMOU/VIPS_TARGET_CUSTOM/g
        edit s/VIPS_STREAMO/VIPS_TARGET/g
        edit s/VIPS_STREAMIU/VIPS_SOURCE_CUSTOM/g
        edit s/VIPS_STREAMI/VIPS_SOURCE/g
        edit s/VIPS_STREAM/VIPS_CONNECTION/g

        edit s/vips_streamou/vips_target_custom/g
        edit s/vips_streamo/vips_target/g
        edit s/vips_streamiu/vips_source_custom/g
        edit s/vips_streami/vips_source/g
        edit s/vips_stream/vips_connection/g

        edit s/VipsStreamou/VipsTargetCustom/g
        edit s/VipsStreamo/VipsTarget/g
        edit s/VipsStreamiu/VipsSourceCustom/g
        edit s/VipsStreami/VipsSource/g
        edit s/VipsStream/VipsConnection/g

        # eg. VIPS_TYPE_STREAM or VIPS_IS_STREAM
        edit "s/VIPS_([A-Z]+)_STREAMOU/VIPS_\1_TARGET_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMO/VIPS_\1_TARGET/g"
        edit "s/VIPS_([A-Z]+)_STREAMIU/VIPS_\1_SOURCE_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMI/VIPS_\1_SOURCE/g"
        edit "s/VIPS_([A-Z]+)_STREAM/VIPS_\1_CONNECTION/g"

        edit s/streamou/target_custom/g
        edit s/streamo/target/g
        edit s/streamiu/source_custom/g
        edit s/streami/source/g

        # various identifiers which also change
        edit s/is_a_stream/is_a_source/g
        edit s/find_load_stream/find_load_source/g
        edit s/find_save_stream/find_save_target/g
        edit s/new_from_stream/new_from_source/g
        edit s/write_to_stream/write_to_target/g
        edit s/vips_thumbnail_stream/vips_thumbnail_source/g

        # eg. vips_webpload_stream
        edit "s/vips_([a-z]+)load_stream/vips_\1load_source/g"

        # eg. vips_webpsave_stream
        edit "s/vips_([a-z]+)save_stream/vips_\1save_target/g"

        mv rename $i
done
```
2019-12-29 21:40:21 +00:00
John Cupitt 4616cf1f5c small changes to the gif-loop fix
see https://github.com/libvips/libvips/pull/1362
2019-12-18 18:09:30 +00:00
Tomáš Szabo 1fde574a86
Merge branch 'master' of https://github.com/libvips/libvips 2019-12-17 07:39:14 +01:00
Tomáš Szabo d14e0d5c97
feat: add normalized `loop` field 2019-12-17 07:28:28 +01:00
John Cupitt f5a4f41edf rename VipsStream* variables
The convention is now:

	VipStreami *streami;

We had `input` in many places, a left-over from the old VipStreamInput
name.
2019-11-11 09:09:34 +00:00
John Cupitt ed6b26fcb1 paste in various fixes from Kleis 2019-10-28 08:51:47 +00:00
John Cupitt 8eeb415b09 Merge branch 'master' into add-stream-object 2019-10-28 05:10:11 +00:00
John Cupitt ee3270f8e9 more refactoring 2019-10-22 11:08:54 +01:00
John Cupitt 430fd97397 oop dropped webp free on load 2019-10-15 17:22:25 +01:00
John Cupitt 98410042ac add webpload stream
webp uses the new VipsStreamInput mmap interface
2019-10-15 15:46:37 +01:00
John Cupitt fef3dae892 Revert "fix up png restart"
This reverts commit 120ba3289c.
2019-10-07 13:15:29 +01:00
John Cupitt 120ba3289c fix up png restart
hopefully ... we needed a png_init_io() as well
2019-10-07 12:11:45 +01:00
Lovell Fuller 8d028420d5 WebP loader: verify upper limit on dimensions in header 2019-08-19 19:33:52 +01:00
John Cupitt 834acad825 fix << on signed int warnings
<< on a negative number is undefined behaviour in C, and will trigger
fuzzer warnings.
2019-08-02 05:35:18 +01:00
John Cupitt 4f2f4b4577 add gif, heif, rad, webp early close 2019-07-21 12:29:25 +01:00
John Cupitt e7b6709f99 use a single loop to get frame and alpha metadata
we had two before, plus use the do/while form recommended for libwebp
frame iteration
2019-07-06 14:46:29 +01:00
Tomáš Szabo bd9c97feed
Changes based on review 2019-07-05 17:23:29 +02:00
Tomáš Szabo 091bb853dd
Merge remote-tracking branch 'upstream/master' 2019-06-30 18:03:45 +02:00
John Cupitt 25af46a189 add rgba -> rgb stage for webp output 2019-06-30 16:53:11 +01:00
Tomáš Szabo 166aae1440
sync fork 2019-06-30 17:10:56 +02:00
John Cupitt 20b9d77086 don't need to test xoff / yoff 2019-06-29 13:18:29 +01:00
John Cupitt d3cd51a8c3 check alpha on animation rects too
see https://github.com/libvips/libvips/issues/1351#issuecomment-506942104
2019-06-29 11:50:26 +01:00
John Cupitt 7d8b6d9d9f note webp change 2019-06-28 04:09:31 +01:00
John Cupitt 8a354c5aec improve webp rgba handling
disable webp alpha output if all frame fill the canvas and are solid

see https://github.com/libvips/libvips/issues/1351
2019-06-27 18:44:38 +01:00
John Cupitt 72c103f95a Revert "remove no-alpha webp support"
This reverts commit d1094847a3.
2019-06-27 17:27:53 +01:00
John Cupitt d1094847a3 remove no-alpha webp support
We used to try to spot webp images with no alpha and load them as plain
RGB, but it turns out this is difficult to do reliably, especially
for animated images.

This patch simply removes support, so all webp images now load as RGBA.

See https://github.com/libvips/libvips/issues/1351
2019-06-27 16:37:11 +01:00
Tomáš Szabo 42218cd613
formatting: use tabs instead of spaces 2019-06-21 15:59:32 +02:00
Tomáš Szabo ae50136845
feat: support frame delays 2019-06-21 15:06:22 +02:00
John Cupitt bd8a6980f5 more consistent behaviour for multi-page load
Some loaders were setting page-height even when the user was loading a
single page triggering unexpected multi-page behaviour from later
savers.

New rule: only set page-height when loading more than one page.

See https://github.com/libvips/libvips/issues/1318
2019-05-29 10:10:28 +01:00
John Cupitt bcdaeca578 fix anim webp load for some sizes
rounding on resize for each frame needs to match resize for whole image
2019-05-01 16:34:58 +01:00
John Cupitt b1c995b2d9 more animated webp load fixes
webpload scale on load works for animated images
2019-05-01 16:25:13 +01:00
John Cupitt 394f9baa5e deprecate webpload @shrink, use @scale instead
We need a fractional scale for thumbnail on webp to work well. @shrink
still works, but @scale overrides it.
2019-04-30 18:29:16 +01:00
John Cupitt 4a9db0e83f fix animated webp background handling
We were using WEBP_FF_BACKGROUND_COLOR as the background colour, but
that's not correct, it should always be zero (transparent).
WEBP_FF_BACKGROUND_COLOR is there just as a hint when flattening down to
plain RGB.
2019-04-24 18:18:21 +01:00
John Cupitt 56e5e3c714 fix memleak on read error in webp
webp read could leak under some error conditions
2019-04-19 15:17:27 +01:00
John Cupitt c8ba6fcae5 tiny cleanups 2019-04-16 18:11:37 +01:00
John Cupitt ce24917d4a only read webp bg in anim
non-anim webp does not use the background property

see https://github.com/libvips/libvips/issues/1261
2019-04-16 17:52:09 +01:00
John Cupitt bafc5775f0 fix ms/cs mixup in webp load/save
there was a mixup between milliseconds (what webp uses for timestamps)
and centiseconds (what gif uses for delay times)
2019-04-16 17:12:57 +01:00