Commit Graph

114 Commits

Author SHA1 Message Date
Kleis Auke Wolthuizen e6198361e5
thumbnail: fix embedded ICC profile conversion (#3027) 2022-10-19 17:32:04 +01:00
Kleis Auke Wolthuizen 5b79a744a7
thumbnail: avoid upsizing via libwebp (#2874) 2022-06-19 12:02:00 +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
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
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 f06c9f3bcf add fail-on to thumbnail
see https://github.com/libvips/libvips/discussions/2781
2022-04-28 09:08:34 +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 168d7652c2 Merge branch '8.12' 2022-03-11 16:25:11 +00:00
John Cupitt f0eb493643 fix thumbnail with cmyk output
see https://github.com/libvips/php-vips/issues/138

thanks AdamGaskins
2022-03-11 16:21:12 +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
John Cupitt 6f9d3ecf91 Merge branch '8.11' 2021-09-05 12:00:20 +01:00
Kleis Auke Wolthuizen 632badabe1
Ensure vips_thumbnail doesn't send an axis to 0 (#2416) 2021-09-05 11:58:44 +01:00
John Cupitt 2041f228f5 fix thumbnail with small plus crop plus no upsize
thumbnail could fail for small images if upsize was disallowed and crop
was enabled, thanks Andrewsville

see https://github.com/libvips/libvips/issues/2157
2021-07-18 15:00:35 +01:00
John Cupitt 69fcf1b9e9
Merge branch 'master' into add-openjpeg 2021-03-27 15:22:13 +00:00
John Cupitt 9589a51f09 fix a compiler warning 2021-03-27 11:35:07 +00:00
John Cupitt 7a900e0a4e add vipsthumbnail support for jp2k
It'll use the jp2k pyramid, if possible.
2021-03-20 12:33:38 +00:00
John Cupitt fc4ad15f97 Merge branch '8.10' 2021-03-07 12:26:24 +00:00
John Cupitt 6666b941bf fix a ref leak in vipsthumbnail
from the previous refactoring
2021-03-06 13:33:00 +00:00
John Cupitt 2e56828053 Merge branch '8.10' 2021-03-06 11:47:02 +00:00
John Cupitt 726fded66c formatting 2021-03-05 11:24:00 +00:00
John Cupitt 9585feb5a8 allow thumbnail colourspace export with no import
allow this case:

	vipsthumbnail k2.jpg --export-profile cmyk

for an image with no embedded profile
2021-03-05 11:11:49 +00:00
John Cupitt c4d56fd475 Merge branch 'revise-premultiply' of github.com:libvips/libvips into revise-premultiply 2021-03-05 10:46:21 +00:00
John Cupitt ef4f95cddc cleanup for Kleis comments 2021-03-05 10:46:06 +00:00
John Cupitt ea2264ea2e
Update libvips/resample/thumbnail.c
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
2021-03-05 10:44:31 +00:00
John Cupitt e1fc576252 back to srgb/b-w processing space
for compat in thumbnail behaviour
2021-02-27 16:34:50 +00:00
John Cupitt 303513e52d small comment polish 2021-02-27 16:00:33 +00:00
John Cupitt 3c60e9de60 start tinkering 2021-02-24 14:48:50 +00:00
John Cupitt df3b80fa40 add vipssave_target() 2021-01-02 15:49:32 +00:00
John Cupitt 10bada0161 tiny thumbnail speedup
thumbnail can skip premultiply/unpre if there's no residual resize
2020-09-21 09:38:11 +01:00
John Cupitt 48a2551957 fix TIFF thumbnail of buffer and source
We had dropped a couple of patches.

see https://github.com/libvips/libvips/issues/1815
2020-09-14 17:26:19 +01:00
John Cupitt cdcf63f8e5 fix regression in thumbnail of pyr tiff
The new subifd pyramid thumbnail code broke the old page-based pyramid
detector.

Thanks tand826

See https://github.com/libvips/libvips/issues/1784
2020-08-17 10:10:23 +01:00
John Cupitt 97eb2e53bd missing copy-memory during thumbnail rotation
see https://github.com/libvips/libvips/issues/1704#issuecomment-655691041
2020-07-09 07:08:49 +01:00
John Cupitt 023f4ca41b fix thumbnail of multi-page TIFF (again)
The addition of subifd handling broke multipage tiff thumbnailing.

See https://github.com/libvips/pyvips/issues/192
2020-06-15 13:13:21 +01:00
John Cupitt 05b0359897 fix regression of multipage tiff thumbnail
the recent subifd addition had broken thumbnail of multipage tiffs,
thanks @petoor

see https://github.com/libvips/pyvips/issues/192
2020-06-15 10:22:01 +01:00
John Cupitt 981d5c4b16 revise autorot system
- deprecate vips_autorot_get_angle() since orientation is no longer a
simple rotate
- add vips_image_get_orientation() and vips_image_get_orientation_swap()
- revise tiff and jpeg loader autorotate to just call vips_autorot(),
but only if necessary
- revise thumbnail autorotate too
2020-06-06 17:25:46 +01:00
John Cupitt d74fe71764 better thumbnail behaviour for subifd pyramids 2020-06-02 14:23:14 +01:00
John Cupitt cff84f4606 add subifd pyr support to thumbnail
thumbnail can spot subifd pyramids and load lower levels if necessary
2020-06-02 12:53:36 +01:00
John Cupitt aaebb3b346 fix thumbnail of mono image
we were using RGB as the shrink space
2020-05-27 15:24:27 +01:00
John Cupitt 5549175b5e add docs for option_string arg to thumbnail
We'd forgotten to add docs for option_string, thanks zhaohuxing.
2020-05-12 10:27:48 +01:00
John Cupitt 54bfa23025 warn against thumbnail_image
see https://github.com/libvips/libvips/issues/1637#issuecomment-623094732
2020-05-03 12:31:17 +01:00
John Cupitt 6f0548dc5c thumbnail could fail on HEIC in some modes
in locked UP or DOWN mode, vips_thumbnail() could incorrectly select the
thumbnail from a HEIC image even when it was not large enough to
generate the output image.

Thanks ZorinArsenij

See https://github.com/libvips/libvips/issues/1614
2020-04-21 10:15:02 +01:00
John Cupitt 34fcd1fe69 fix autorot in thumbnail
`vips_thumbnail()` was not taking a private copy of the image before
modifying metadata during auto-rotate.

Thanks janko.

See https://github.com/libvips/libvips/issues/1523
2020-01-12 14:24:23 +00:00
John Cupitt 5b09845bd5 don't set page-height in thumbnail unless we must
We were always setting page-height in thumbnail, even on single-frame
images. This could cause problems if the image height was later
increased by a factor of the height -- non-animated images could
accidentally turn into animated images.

https://github.com/libvips/libvips/issues/1469
2020-01-06 17:04:01 +00: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 686829166d fix some more metadata updates
some more minor cases picked up by the test suite
2019-11-30 12:11:23 +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 ee3270f8e9 more refactoring 2019-10-22 11:08:54 +01:00
John Cupitt 5f6911d516 add thumbnail_stream
this works:

	$ cat k2.jpg | vips thumbnail_stream [descriptor=0] x.jpg 200
	$ vipsheader x.jpg
	temp-0: 141x200 uchar, 3 bands, srgb, jpegload
2019-10-12 17:37:31 +01:00
John Cupitt a92f0ed504 smarter heif thumbnail selection in `thumbnail`
We were checking for thumbnail width and height > target width and
height, but of course we can have one of target width or height very
large if we are leaving that axis to float in size.

Instead, calculate a shrink from the heif thumbnail size and see if that is
>= 1.0, ie. we can generate output without upsizing.
2019-09-30 14:34:11 +01:00