Commit Graph

561 Commits

Author SHA1 Message Date
John Cupitt 4f2f4b4577 add gif, heif, rad, webp early close 2019-07-21 12:29:25 +01:00
John Cupitt 2c654060f9 experiment with a different early-close strategy
We close loaders early in order to save file handles, and on Windows to
make sure that files can be deleted as soon as possible.

Currently loaders do this by watching the Y coordinate of requests and
freeing the fd when the final line of the file is fetched. This is messy
and does not always work, since there are cases when the final line is
not fetched.

Instead, this patch gets loaders to listen for "minimise" on their
output and close on that. This signal is emitted on all upstream images
whenever a threadpool finishes a scan of an image and is usually used to
trim caches after computation.

See https://github.com/libvips/libvips/issues/1370
2019-07-20 16:31:30 +01:00
John Cupitt 7f47acab56 tiny improvement 2019-07-10 17:43:17 +01:00
John Cupitt 5e2d66d14b better early shutdown behaviour in shrinkv
read the tail of the input to force early shutdown in seq readers

does reducev need something similar?

see https://github.com/kleisauke/net-vips/issues/12
2019-07-09 16:58:30 +01: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 8a98bea063 fix vipsthumbnail for pyr tiff files
thumbnail was not testing pyramidal tiff images for pyramidness correctly.

see https://github.com/libvips/libvips/issues/1297
2019-06-19 17:56:09 +01:00
John Cupitt da402cee23 faster and more accurate bilinear
go to fixed point earlier in calculation of interpolation coefficients
2019-05-14 13:10:45 +01:00
John Cupitt 29d9673fd8 update comment 2019-05-14 08:20:30 +01:00
John Cupitt 44afdbc314 more accurate bicubic of int16 images
use float path for int16 -- the fixed-point path can miss by a small
amount

see https://github.com/libvips/libvips/issues/1309
2019-05-13 22:05:41 +01:00
John Cupitt c9ba0915c1 more accurate bilinear for int16 pixels
fixed-point interpolation could give small errors

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

need a similar change for bicubic etc.
2019-05-13 18:32:48 +01:00
John Cupitt 37865e34f8 oop silly webp jpg mixup in last commit 2019-04-30 20:07:08 +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 7326a409c6 reenable webp shrink-on-load in thumbnail
the breakage is in animated webp load with preshrink rather than
thumbnail
2019-04-29 17:30:34 +01:00
John Cupitt 522ddc1430 better thumbnailing of multipage docs
shrink-on-load should now work for multipage PDF thumbnailing

see https://github.com/libvips/libvips/issues/1297
2019-04-29 17:05:19 +01:00
John Cupitt 8482aa3ff1 tiny cleanup
some left-over pyramid detection code in tiff2vips
2019-04-29 12:52:47 +01:00
John Cupitt efadb5dc42 fix thumbnail shrink-on-load
we had the alignment check in the wrong place
2019-04-27 22:33:20 +01:00
John Cupitt 0102a10b49 seems to work 2019-04-24 17:04:31 +01:00
John Cupitt 0df3f0268c Merge branch 'master' into revise-thumbnail 2019-04-24 16:11:25 +01:00
John Cupitt bb22f66453 oop remove git markup 2019-04-24 16:11:08 +01:00
John Cupitt 8b71d0179c Merge branch 'master' into revise-thumbnail 2019-04-23 20:27:30 +01:00
John Cupitt d2a9a20a78 fix thumbnail regression with cmyk in and out
56d98f3ef0 broke cmyk->cymk thumbnails
2019-04-23 17:09:20 +01:00
John Cupitt 56d98f3ef0 thumbnail no longer needs to import cmyk
since colourspace knows about cmyk now
2019-04-23 11:35:13 +01:00
kleisauke f40eb5ec13 Fix thumbnailing of a WebP image 2019-03-13 17:33:07 +01:00
John Cupitt f06a01ccbe better toilet-roll detection 2019-03-04 09:55:53 +00:00
John Cupitt 29d33b2753 start work on toilet-roll thumbnails again 2019-03-02 22:13:55 +00:00
John Cupitt 15ee957ea9 Merge branch 'master' into revise-thumbnail 2019-03-02 22:06:23 +00:00
John Cupitt 64c7165759 fix some clang warnings 2019-03-02 16:23:19 +00:00
John Cupitt b565f2fc68 more accurate bilinear
use double, not float, for coefficient calculation, or we get overshoots
in some cases

see https://github.com/libvips/libvips/issues/1239
2019-02-27 20:33:31 +00:00
John Cupitt cf860b27fa start working over thumbnail to support anim 2019-02-19 17:27:23 +00:00
John Cupitt 1a83605238 Merge branch 'add-heifload' 2019-02-17 17:11:14 +00:00
John Cupitt f23d0fd754 note new option_string param in changelog 2019-02-03 12:27:58 +00:00
kleisauke f40062c495 s/open_args/option_string/g 2019-02-03 12:29:54 +01:00
kleisauke 05c459cc28 vips_thumbnail_buffer: add optional open_args argument (#1147) 2019-02-02 09:26:12 +01:00
John Cupitt 308c85c004 add support for stored heif thumbnails 2019-01-30 16:19:11 +00:00
John Cupitt 9303e382c1 Merge branch '8.7' 2018-12-17 20:31:25 +00:00
John Cupitt 6ba4b3bfdb fix clipping with new mapim cods
we had the clip in the wrong place

see https://github.com/libvips/libvips/issues/1180
2018-12-17 20:29:31 +00:00
John Cupitt 962cab2d0f Merge branch '8.7' 2018-12-17 13:18:58 +00:00
John Cupitt db4fe60405 fix mapim offsets
pixels were not being offset by the stencil origin, so interpolators
like bicubic could fail

thanks @erdmann

https://github.com/libvips/libvips/issues/1180
2018-12-17 12:42:34 +00: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 0669cf2a23 Merge branch 'master' into add-webp-animated 2018-11-23 17:41:09 +00:00
John Cupitt 6b9d89b103 add pyr tiff shrink-on-load for thumbnail 2018-11-16 18:00:25 +00:00
John Cupitt d4823489dc switch to libwebpmux for webp write
we had our own horrible thing before
2018-11-01 18:50:10 +00:00
John Cupitt 7303ecbebb typo
thanks @becoded
2018-10-31 14:09:57 +00:00
John Cupitt 22ba9106b5 implement shrink-on-load for openslide thumbs
makes vipsthumbnail much quicker on openslide images, obviously

see https://github.com/libvips/libvips/issues/1149
2018-10-31 14:07:13 +00:00
John Cupitt 0b050f4046 deprecate thumbnail auto_rotate, add no_rotate
the auto_rotate option of thumbnail was default TRUE which made it
useless from the CLI, since GOption only allows --switch, not
--switch=false

deprecate auto_rotate, add no_rotate, but allow either to be used

see https://github.com/libvips/libvips/issues/1146
2018-10-31 12:30:37 +00:00
Yazan Medanat 90f578a05f Change jcupitt references to libvips. 2018-09-21 09:05:47 -07:00
John Cupitt 643e7c0ea2 mapim fix for strange float values
mapim could fail for float index images outside the int range

minor speedup too
2018-08-12 17:10:23 +01: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 754a1e5419 Merge branch 'master' into add-canny 2018-03-14 14:18:39 +00:00
John Cupitt 08dcf29b10 add vips_rotate()
vips_similarity() was a little hatrd to discover, so add vips_rotate()
as a more obvious name for it
2018-03-10 18:45:39 +00: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 da7b62680d simpler profile handling for thumbnail
use the fallback handling logic in vips_icc_*() instead of having our own
2018-01-01 18:52:54 +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
Lovell Fuller f0949fbfcb Allow -DDEBUG build to compile 2017-12-06 22:04:11 +00:00
John Cupitt c5139a0e50 doc fixups
various small things; fix the docs for composite, reduceh and reducev
2017-12-04 13:42:31 +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 3754ddb947 remove centre from resize in thumbnail
thanks kleis
2017-11-26 12:01:30 +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 2815647ce3 fix background for affine on alpha images
need to convert to ink for premultiplied space
2017-11-18 13:42:00 +00:00
John Cupitt e179e3b11f premultiply alpha (if necessary) in affine 2017-11-18 10:59:20 +00:00
John Cupitt fcec6d639b fix jaggies on the edge of affine output
and add a "background" param
2017-11-17 16:30:25 +00:00
John Cupitt 990b68b54b typos 2017-10-23 18:05:41 +01:00
John Cupitt a8bbe05596 tiny optimisations 2017-10-16 20:55:58 +01:00
John Cupitt 0767e4f4c9 remove a 0.5 pixel shift from triangle
lines up with cubic and lanczos now
2017-10-16 09:38:04 +01: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 1ed7e66833 Remove duplicate doc comment for 'VipsKernel'
Now that resample/reduceh.cpp is being scanned by g-ir-scanner, g-ir-scanner was giving this warning:
resample/reduceh.cpp:58: Warning: Vips: multiple comment blocks documenting 'VipsKernel:' identifier (already seen at reduce.c:55)
2017-10-02 22:12:39 +01:00
Alistair Thomas c24d36fc79 Update GObject introspection annotations for libvips/resample directory 2017-09-30 17:26:55 +01:00
John Cupitt 3d40769401 tiny cleanups 2017-09-15 10:39:06 +01:00
Kleis Auke Wolthuizen 1e26b1a6c3 vips_thumbnail: Fix SVG/PDF input (#735) 2017-09-14 16:03:21 +02:00
John Cupitt 5a37d3e809 add an intent option to thumbnail
"intent" lets you set the rendering intent for any ICC conversions --
the default is the (more correct) relative, but "perceptual" can look
better

see https://github.com/jcupitt/libvips/issues/714
2017-08-30 16:34:46 +01:00
John Cupitt 189c5f4762 fix a copy-paste error 2017-08-18 22:38:35 +01:00
John Cupitt 97997d1990 Merge branch '8.5' 2017-08-18 22:13:51 +01:00
John Cupitt f2576003b7 fix webp upscale in thumbnail
we could try to use webp shrink on load to upscale, oops

see https://github.com/jcupitt/libvips/issues/710
2017-08-18 22:08:43 +01:00
John Cupitt 34970d0cf2 remove some casts
and use VIPS_AREA instead
2017-07-26 14:57:27 +01:00
John Cupitt 47f35dd2f1 oop left a DEBUG on 2017-06-23 12:19:35 +01:00
John Cupitt 52daec74e4 note gcc 7.1 stuff 2017-06-20 18:34:25 +01:00
John Cupitt 3f69762163 Merge branch 'master' of github.com:jcupitt/libvips 2017-05-29 18:59:13 +01:00
John Cupitt cbd9fad040 fix a few more problems with input args
a few other operators were modifying input args and messing up caching
2017-05-29 18:58:24 +01:00
Lovell Fuller 850a28d3c3 Silence 'missing sentinel' warnings in GCC v6+ 2017-05-29 14:37:53 +01:00
John Cupitt aeff03b951 Merge branch '8.5' 2017-05-29 10:21:02 +01:00
John Cupitt 7bcf0bb93f don't cache thumbnail
thanks tomasc! see

jcupitt/ruby-vips#109
2017-05-29 10:19:21 +01:00
John Cupitt 82994e4c33 add vips_thumbnail_image()
thumbnail with an image source, see

https://github.com/jcupitt/libvips/issues/656
2017-05-12 18:20:37 +01:00
John Cupitt 2f6f2b93ef add more thumbnail tests
esp. the new force mode
2017-05-05 14:13:49 +01:00
John Cupitt 8e7a00105f fix --force and autorot
need to swap output axes, not input
2017-05-05 09:45:21 +01:00
John Cupitt 260180197d done! but needs some tests 2017-05-04 14:54:49 +01:00
John Cupitt 3900cebdf8 start adding FORCE
start experimental implementation

see https://github.com/jcupitt/libvips/issues/648
2017-05-01 17:22:03 +01:00
John Cupitt 722314ed10 one printf too many 2017-04-23 08:38:06 +01:00
John Cupitt 0a5375b6cd Merge branch 'master' into remove-seq-stalling 2017-03-15 12:26:44 +00:00
John Cupitt fd6006bacb Merge branch 'master' into add-smartcrop 2017-03-13 20:41:22 +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 9e6832b34d add --smartcrop to vipsthumbnail
does the obvious thing
2017-03-08 14:31:00 +00:00
John Cupitt 3ca206815c put a seq on reducev too 2017-03-07 11:27:36 +00:00
John Cupitt daaea28a5e shrinkv seq cache should be another sequential 2017-03-06 16:25:19 +00:00
John Cupitt e4ab251fd1 small cleanups
make embed less chatty with --vips-cache-trace

shrink can use linecache now

found a fail case on the work machine
2017-03-06 14:51:45 +00:00
John Cupitt 362c7efdfc argh reapply seq removal 2017-03-06 11:55:38 +00:00
John Cupitt dd5a108854 fix up new seq mode stuff
seems to work
2017-03-05 21:59:53 +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 e6b20cbd0f Revert "remove stalling"
This reverts commit 959f412380.
2017-02-27 10:26:32 +00:00
John Cupitt e7ae10ef68 Revert "more UNBUF fixes"
This reverts commit a4d3c2a754.
2017-02-27 10:25:41 +00:00
John Cupitt 6cbda61ec1 fix thumbnail crop on rotated images
crop after rotate so we don't need to rotate the crop box

thanks ElHeineken!

see https://github.com/jcupitt/libvips/issues/608
2017-02-23 20:26:59 +00:00
John Cupitt a4d3c2a754 more UNBUF fixes
try to keep compat better, remove the single-thread-first-tile idea
2017-02-21 16:53:48 +00:00
John Cupitt 959f412380 remove stalling 2017-02-21 15:03:15 +00:00
John Cupitt 646960077d fix cache hint for shrink
shrink had UNBUFFERED as a cache hint, but for non-int shrinks it used
affine, so you could get out of order reads

set regular SEQ as the cache hint, and switch to reduce for the final
resize in the non-int case

see https://github.com/jcupitt/libvips/issues/596
2017-02-09 09:10:03 +00:00
John Cupitt b140c18a37 various tweaks to calm coverity
passes cleanly now
2017-01-20 08:55:13 +00:00
John Cupitt fb88d037fc Merge branch 'master' into add-thumbnail-geometry 2017-01-17 11:51:10 +00:00
John Cupitt 6b325145e4 use new hints and prepare everywhere 2017-01-12 14:36:44 +00:00
John Cupitt c5e675f7db fix --vips-cache-max etc.
--vips-cache-max, --vips-cache-max-memory and --vips-cache-max-files were not
working and probably hadn't been for a while

vipsthumbnail.c turns off the operation cache, it's not useful for
the same operation repeated across many files
2017-01-10 14:12:24 +00:00
John Cupitt 2fa3736722 all done, I think 2017-01-06 13:43:43 +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 5644296b1c expand intro to resample 2016-11-21 13:10:06 +00:00
John Cupitt 7d0c821a6e add tests for thumbnail 2016-11-02 13:51:09 +00:00
John Cupitt 0faedcd088 docs done 2016-11-02 11:19:08 +00:00
John Cupitt d4b4eb44a3 works! 2016-11-02 11:07:30 +00:00
John Cupitt efe824ec13 compiles! 2016-11-02 09:29:19 +00:00
John Cupitt b7dd72e166 start hacking 2016-10-31 11:14:54 +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 1e9cdef615 try centre sampling option 2016-09-09 14:51:45 +01:00
John Cupitt 271d8656e9 use round() rather than rint() where appropriate
rint() rounds to nearest even, rather than nearest ... in some cases,
like geometry transforms, we want strict nearest
2016-08-20 12:59:41 +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 2e8f14c6a5 Merge branch 'master' into rewrite-convf 2016-08-01 15:08:45 +01:00
John Cupitt b6768a7e0f small speedup for reduceh 2016-08-01 12:04:15 +01:00
John Cupitt 23d9bad581 doc improvements 2016-07-13 09:24:41 +01:00
John Cupitt 097ecd07c1 doc improvements 2016-07-13 07:06:43 +01:00
John Cupitt 0c2259d34b improve similarity docs
rotation direction was wrong, add type comments

https://github.com/jcupitt/libvips/issues/475
2016-06-28 17:07:14 +01:00
John Cupitt bd7bad1916 almost done vector path 2016-06-28 11:07:20 +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 a5bef08d4a better reducev multiplication
more accurate, no slower

add more tests too
2016-06-15 13:56:19 +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 65b9ced6e9 improve arg order
more consistent
2016-04-11 13:23:25 +01:00
John Cupitt 269cbb8641 better mask sizing for lanczos 2016-04-11 13:19:00 +01:00
John Cupitt 511a0a7da5 better rounding in reducev orc path 2016-04-10 17:52:51 +01:00
John Cupitt 8aa4566c87 update notes 2016-04-02 20:24:54 +01:00
John Cupitt bc320f1090 much better int mask creation
removes some banding from the orc path for reducev
2016-04-02 18:46:10 +01:00
John Cupitt 3115310bb7 fix no-orc builds 2016-03-26 10:45:31 +00:00
John Cupitt 2ab14a3590 better rounding in vector reducev
add before downshift to round to nearest on 16->8 fixed-point conversion
2016-03-25 06:07:58 +00:00
John Cupitt ec5cdf4fff Merge branch '8.2' 2016-03-24 16:09:44 +00:00
John Cupitt 72ea91fecc fix nohalo, vsqbs interpolators
we were getting occasional memory access problems in nohalo and vsqbs
interpolators ... the previous fix was not enough

version bump
2016-03-24 16:06:31 +00: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 3c98ba78a0 small experiment 2016-03-22 14:19:32 +00:00
John Cupitt e8b5cb6c23 add VIPS_COUNT_PIXELS, overcomputation tracking
added VIPS_COUNT_PIXELS(), use like this:

	static int vips_shrinkh_gen( VipsRegion *or, ... )
	{
        	VIPS_COUNT_PIXELS( or, "vips_shrinkh_gen" );
	}

and on image close, if more than 100% of the pixels have been
calculated, you get a warning

only if you enable debugging, since this hurts perf slightly
2016-03-22 12:26:45 +00:00