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
John Cupitt
f0bb3e3442
Merge branch '8.13'
2022-10-14 20:06:34 +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
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
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
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
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
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
John Cupitt
896cad6a7a
Add spngsave ( #2536 )
...
* quick hack
won't even compile
* works!
at a basic level, anyway
* start wiring up metadata
* metadata done
* add spng interlaced save
* start adding index support
* fix palette save
* Update libvips/foreign/spngsave.c
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
* start adding low bit depth write
* add a warning for low bitdepth write
* small fixes
* add 1/2/4 bit write
adapted from the vips2tiff bit packer
* small polish
* note spngsave in changelog
* Update libvips/foreign/spngsave.c
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
* Update libvips/foreign/spngsave.c
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
* revise 8 and 16-bit PNG write rules
* cleanup
* remove unnecessary palette filter optimisation
since libspng already does this
* add xres/yres rounding
thanks klies
he commit message for your changes. Lines starting
* look for spng.pc and libspng.pc
It can be called either, frustratingly.
* fix PACKAGES_USED for spng .pc changes
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2022-02-11 16:30:23 +00:00
John Cupitt
ce54b4e5ad
Merge branch '8.12'
2022-01-13 11:47:53 +00:00
John Cupitt
6b475c92a2
raise linpng size limit
...
By default libpng is limited to 1m pixels per axis. Raise this to
VIPS_MAX_COORD, ie. 10m pixels.
2022-01-13 11:44:28 +00:00
John Cupitt
56a7916e80
remove stray error messages
2022-01-09 12:20:25 +00:00
Sergey Alexandrovich
d71a3c2fc1
Quantizr support ( #2542 )
2021-11-21 10:11:28 +00:00
John Cupitt
0c70f3dc7d
add fail-on : better control over loader error handling ( #2360 )
...
Instead of a simple fail/don't-fail boolean switch, add fail-on, an enum which sets the sensitivity of loaders to errors.
There's a new sensitivity level which tries to detect truncated images, but ignores other types of error.
2021-10-31 14:13:18 +00:00
John Cupitt
1caad7f228
Merge branch '8.11'
2021-09-13 15:00:21 +01:00
John Cupitt
15416c410d
raise the PNG text chunk limit
...
Raise the PNG text chunk limit to 50, since it seems some real images
have a text chunk per line of exif data.
See https://github.com/libvips/libvips/issues/2433
2021-09-13 14:40:20 +01:00
Lovell Fuller
e16cb5bfe5
quantise: optional thresholding of alpha channel ( #2425 )
...
Moving this logic from gifsave to quantise improves
the performance of writing RGBA GIFs by ~15%
2021-09-07 12:23:42 +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
Joshua Sager
bb88490a17
Introduce unlimited flag, enabling unlimited text chunks in PNGs ( #2419 )
...
* Introduce unlimited flag, enabling unlimited text chunks
* remove extraneous optional flag causing GLib-GObject-CRITICAL **: 17:10:34.095: validate_and_install_class_property
* Address feedback from @jcupitt
* various compilation error fixes
* Interlace detection uses unlimited=false
* attempt to fix tests
* documentation changes, introduced MAX_PNG_TEXT_CHUNKS and bumped max to 20 (was 10)
2021-08-29 18:41:49 +01:00
Joshua Sager
608a7cee9b
Introduce unlimited flag, enabling unlimited text chunks in PNGs ( #2419 )
...
* Introduce unlimited flag, enabling unlimited text chunks
* remove extraneous optional flag causing GLib-GObject-CRITICAL **: 17:10:34.095: validate_and_install_class_property
* Address feedback from @jcupitt
* various compilation error fixes
* Interlace detection uses unlimited=false
* attempt to fix tests
* documentation changes, introduced MAX_PNG_TEXT_CHUNKS and bumped max to 20 (was 10)
2021-08-29 18:06:33 +01:00
John Cupitt
1ce301812d
Merge branch '8.11'
2021-08-06 17:00:24 +01:00
John Cupitt
fd1a036cd8
limit number of PNG chunks
...
reduces the threat of PNG decompression bombs
2021-08-06 10:55:08 +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
Lovell Fuller
aabb1555d2
pngsave: expose quantisation effort setting ( #2367 )
2021-07-30 10:43:42 +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
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
65cab8db7d
tiny cleanups for png write
2021-02-07 15:23:46 +00:00
Kleis Auke Wolthuizen
9b9843f698
Exclude libpng load when building with libspng
...
Similar to ce63fc1
, but allowing libpng to be configured with
-DPNG_NO_READ (i.e reading functionally disabled).
2020-12-29 13:34:22 +01:00
John Cupitt
4de9b56725
flush target at end of write
...
we were missing end-of-write flushes on four save operations
thanks harukizaemon
see https://github.com/libvips/ruby-vips/issues/256
2020-11-04 09:28:25 +00:00
John Cupitt
17cddc196b
improve pngload error messages too
...
see https://github.com/libvips/libvips/issues/1578
2020-07-23 15:41:20 +01:00
John Cupitt
70c0b36d4f
better pngsave error message
...
add a target name to png's "unable to write to target" message
see https://github.com/libvips/libvips/issues/1578
2020-07-23 15:26:11 +01:00
John Cupitt
36ac84ee6f
fix spngload default ppm
2020-07-15 10:56:34 +01:00
John Cupitt
4bf27acccb
add 1/2/4 bit PNG save
...
- new @bitdepth param
- deprecate @colours param
2020-06-25 10:40:43 +01:00
John Cupitt
b9385b9d35
only warn on png save with a bad profile
...
Previously we failed. This is very ugly, but it seems to be the only
obvious way to fix this.
See https://github.com/libvips/libvips/issues/1578
2020-05-11 18:00:26 +01:00
John Cupitt
9e6df7e0a6
revise png comments
2020-02-07 17:53:42 +00:00
John Cupitt
ecb22cdecc
free png write on end of write, not image dispose
...
We were freeing the PNG write struct on image dispose, not at the end of
write.
Thanks homm. See https://github.com/libvips/pyvips/issues/147
2020-01-02 15:51:42 +00:00
John Cupitt
252996e3ff
make check passes after stream -> source rename
2019-12-30 12:48:20 +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
0429a0080e
swap ssize_t for gint64 where possible
...
Some versions of the Windows headers define ssize_t as unsigned. This
patch removes (where possible) use of ssize_t inside libvips, esp. in
the new stream API.
See https://github.com/libvips/libvips/issues/1494#issuecomment-568254731
2019-12-22 13:45:45 +00: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
3d344b4b5f
add Kleis's patches
...
and add minimise support to radiance load
2019-11-06 17:04:13 +00:00
John Cupitt
ba0100eb13
revise decode/unminimise use
2019-10-28 05:04:04 +00:00
John Cupitt
ee3270f8e9
more refactoring
2019-10-22 11:08:54 +01:00
John Cupitt
f99f3d3f57
revise seek() behaviour
...
fuzz tests fail though ... we need to split StreamInput up
2019-10-17 17:18:45 +01:00
John Cupitt
696ff2b24a
fix up jpeg load
...
and revise descriptor test
2019-10-17 13:16:12 +01:00
John Cupitt
88aa1bca86
polish png read
2019-10-15 08:33:48 +01:00
John Cupitt
c3e1dd47bf
fix test suite
...
passes now
2019-10-14 21:01:25 +01:00