Commit Graph

69 Commits

Author SHA1 Message Date
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
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 75632a5641
Merge pull request #1592 from kleisauke/issue-703
Fix the pixel shift within reduce (#703)
2020-06-12 12:36:22 +01:00
John Cupitt 4469afaeb0 better handling of "nearest" in resize
we now use vips_subsample() for this case
2020-06-12 12:03:15 +01:00
Kleis Auke Wolthuizen ac358ff4b8 Fix the pixel shift within reduce (#703) 2020-06-06 14:01:34 +02:00
John Cupitt ba0dea001d sort out premultiply rules for upsizing
vips_resize() uses vips_affine() for upsizing and vips_reduce() for
downsizing. Affine automaticaly does a vips_premultiply() for images
with an alpha channel, but reduce does not. This meant that we could
sometimes premultiply twice.

This patch adds a "premultiplied" flag for affine which turns automatic
premultiuplication off, vips_resize() uses this to block affine's auto
premul feature, and the resize docs are clarified to stress that the
operation does not do premultiplication for you.

See https://github.com/libvips/libvips/issues/1629
2020-05-19 14:31:34 +01:00
John Cupitt e1baf66f19 "squash" to tiffsave now does lab as well
The "squash" option to tiffsave now also squashes 32-bit 3-band float
CIELAB images down to 8 bits.

See https://github.com/libvips/libvips/issues/1499
2019-12-18 17:29:34 +00:00
John Cupitt f45f0ecef4 limit resize if shrink would drop axis <1px
vips_resize() will break the aspect ratio and limit resize on an axis if
it would result in an image of less than 1px on that axis

see https://github.com/lovell/sharp/issues/1782#issuecomment-508921306
2019-07-07 10:19:33 +01:00
John Cupitt f5d76b42fc fix centre sampling for non-int nearest upscale
we were not disabling the input offset for NEAREST, whcih is always
centre

thanks edwjusti

see https://github.com/lovell/sharp/issues/1479
2018-12-03 17:13:57 +00:00
John Cupitt 3b1e3e1841 add Mitchell kernel
see https://github.com/jcupitt/libvips/issues/966
2018-06-12 12:55:10 +01:00
John Cupitt 407291c3ff try a simpler edge detect in canny
simple +/- differencing seems to work better
2018-02-08 17:14:26 +00:00
John Cupitt e9b7231ac0 add "extend" option to affine
so for upsizing with displacement (like resize) we can prevent dark
edges on bright images

see

https://github.com/jcupitt/php-vips/issues/61
2017-12-07 14:51:07 +00:00
John Cupitt 406e228c9b vips_resize() is always centre convention
it was corner for downsize, but should be centre to match imagemagick
2017-11-26 15:24:40 +00:00
John Cupitt ee4186ae8f revise resize docs 2017-11-25 15:13:20 +00:00
John Cupitt 7db13412e5 deprecate centre option to resize
it's now centre on upsize, corner on downsize

see https://github.com/jcupitt/libvips/issues/705
2017-11-25 14:22:20 +00:00
John Cupitt cb128eb258 apply --centre to upsize as well as down
we were just using the --centre flag in resize to influence downsize
behaviour -- use it to set upsize as well

see https://github.com/jcupitt/libvips/issues/705
2017-11-25 12:09:01 +00:00
John Cupitt 68ed42e2fa make linear and cubic adaptive 2017-10-15 22:09:44 +01:00
John Cupitt cf1e6e3ef8 oh dear, missing breaks in switch
too much ruby sigh
2017-10-13 12:16:03 +01:00
John Cupitt de82c9e919 allow much larger reduce factors
sometimes you want to use lanczos etc. for everything
2017-10-09 11:48:11 +01:00
Lovell Fuller ea6d496484 Upsample integral nearest neighour with zoom for accuracy.
This mirrors logic from sharp, allowing it to migrate to resize.

See https://github.com/lovell/sharp/issues/752
2017-10-03 19:44:34 +01:00
Alistair Thomas c24d36fc79 Update GObject introspection annotations for libvips/resample directory 2017-09-30 17:26:55 +01:00
John Cupitt 0a5375b6cd Merge branch 'master' into remove-seq-stalling 2017-03-15 12:26:44 +00:00
John Cupitt d7da3c7de7 fix vips_resize() bug
if hscale and vscale were very different, resize could fail with "reduce
factor too large" ... just a silly typo
2017-03-10 10:22:40 +00:00
John Cupitt 362c7efdfc argh reapply seq removal 2017-03-06 11:55:38 +00:00
John Cupitt 55840cf131 try setting a seq meta
and only caching in shrinkv if we see the tag
2017-03-05 21:59:01 +00:00
John Cupitt 20f99b62cf more ideas 2017-03-05 21:59:01 +00:00
John Cupitt 2be0b97dce switch to g_warning()_/g_info()
we had vips_warn() and vips_info(), but they are a bit crappy ... switch
to g_warning() and g_info() instead

see https://github.com/jcupitt/libvips/issues/544
2017-01-03 15:52:27 +00:00
John Cupitt d3cafb3a9f seems to work
add @centre option for downsampling, see

https://github.com/jcupitt/libvips/issues/504
2016-09-10 10:31:33 +01:00
John Cupitt 1f403a4add first attempt
seems to all work, test it a bit more

see https://github.com/jcupitt/libvips/issues/491
2016-08-15 15:45:26 +01:00
John Cupitt 65105a9442 upsize with something other than nearest
vips_resize() uses to just use nearest when upsizing, following standard
practice in repro. This is often unfortunate for image processing, where
small nearest upsizes will produce obvious aliasing.

It now picks a VipsInterpolate which corresponds (roughly) to the
selected VipsKernel and uses that with affine for any upsizing.
2016-06-22 10:33:08 +01:00
John Cupitt f3326c8126 better vips_resize() for cubic/linear/nearest
vips_resize() used to do most of a downsize with vips_shrink() and the
final 200 - 300% with vips_reduce(). This was correct for lanczos2/3,
but not right for linear/cubic, which need more shrink and less
reduce to avoid aliasing.

This patch makes vips_resize() leave the final 100 - 200% to
vips_reduce() for linear/cubic, and leave everything to reduce for
nearest.
2016-06-16 09:46:02 +01:00
John Cupitt 948d1103d4 note more webp tests needed 2016-05-07 19:53:00 +01:00
John Cupitt 1ae92bb15f make optional args into bullets
make docs easier to read
2016-05-02 10:12:37 +01:00
John Cupitt 02821ae9e3 expose @kernel setting for vips_resize()
a new optional arg lets you pick the downsizing kernel
2016-05-01 12:33:49 +01:00
John Cupitt c2d1de9a26 allow mixed zoom and shrink in resize
vips_resize() now allows >1 on one axis, <1 on the other ... previously,
although you could have non-square ratios, you couldn't mix zoom and
shrink
2016-05-01 12:03:13 +01:00
John Cupitt 36e0b60ffa put the resize cache back again
stops overcomputation on vips_shrink()
2016-03-22 14:35:44 +00:00
John Cupitt 46a18118c6 works! 2016-03-15 16:46:18 +00:00
John Cupitt ff88087a28 try making the reduce mask larger with residual 2016-03-15 14:59:59 +00:00
John Cupitt 45c3fea6ac more resize tuning 2016-03-15 09:49:30 +00:00
John Cupitt ac4e5ce059 return of shrink-less-affine-more
though a bit less extreme
2016-03-14 14:58:02 +00:00
John Cupitt fba2ac2f85 fix sizing issues with new reduce code
a couple of bugs and some changed conventions
2016-03-13 17:44:24 +00:00
John Cupitt f12fef4aa9 fix compile 2016-03-13 11:35:35 +00:00
John Cupitt 70db9aa77b better rounding in resize 2016-03-12 13:14:34 +00:00
John Cupitt 493482c8a7 hey ho, line cache goes back too 2016-03-11 14:56:06 +00:00
John Cupitt 08e8c27e38 moore vips_resize() tuning
put back the mild post-shrink sharpen, a little more anti-alias

see https://github.com/jcupitt/libvips/issues/404#issuecomment-195297607
2016-03-11 10:17:41 +00:00
John Cupitt 5d31d8e824 turn up anti-alias for small shrinks
a little more anti-alias for small reductions

see https://github.com/jcupitt/libvips/issues/404#issuecomment-195276154
2016-03-11 09:25:33 +00:00
John Cupitt 2ca7b29214 better gauss mat generation 2016-03-10 22:01:55 +00:00
John Cupitt 4974a1ed9c better rounding for vips_resize()
we were getting off by one size errors
2016-03-10 19:53:05 +00:00
John Cupitt d351e07a6b finish up 2016-03-10 17:33:34 +00:00