-
Notifications
You must be signed in to change notification settings - Fork 27
vips_get_tile_size missing #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm on holiday this week, I'll look into this when I get back.
…On Sun, 12 Feb 2017 at 20:30, Kleis Auke Wolthuizen < ***@***.***> wrote:
To reduce memory usage and improve performance we did some tests with sequential
mode read, from our tests in looks promising. However we're missing 1
function that is in libvips and not in the PHP binding:
- vips_get_tile_size
<http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/VipsThreadState.html#vips-get-tile-size>
(some operations needs a tilecache to prevent over-computation)
General question:
Sequential read mode does not work with rotate, sharpen, gaussblur and
our trim function. If we have to deal with these operations we force the
access mode to VIPS_ACCESS_RANDOM, do you recommend this? I was not sure
if a tilecache fixes this.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#33>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjc6-7Udh-Tr1a8VnekXmEGaUsRzjUEks5rb126gaJpZM4L-lgJ>
.
|
There's no hurry, have a great holiday! |
Hi again, #!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
use Jcupitt\Vips;
$image = Vips\Image::newFromFile($argv[1], ['access' => 'sequential']);
$image = $image->gaussblur(4);
$image->writeToFile($argv[2]); There are two sequential modes. The regular seq mode (as above) keeps a buffer of a few 100 lines behind the processing point so that operations can refer backwards. This is how blur and sharpen are able to work. There's also Why do you need |
I've made a sample script which occasionally fails with For the test image: https://rbx.weserv.nl/lichtenstein.jpg This scripts fails sometimes with this warning:
For a live demo: http://t0.nl/test.php (just hit F5 and you'll see occasionally HTTP 500 errors) I think I will need a tile cache at line 85-86. |
Ah OK, yes
So it'll need 15 scanlines to compute the blur, then if you've previously shrunk by x5 (for example), you need 15 * 5, or 75 lines from the input. I would try adding a tilecache just before the blur. Set the tile width to the image width, the tile height to 1, and If you don't mind tying yourself to libvips 8.5, use |
The resize logic is based on the sharp library (that library uses a tile cache in the resize function, see this and this). They are also investigating adding a tile cache before some operations, I'll link it for further reference: lovell/sharp#709 So if I understand correctly the I’ve considered
|
Hi again, you can get the image size very quickly with You're right that the crop in You could steal some of the shrink-on-load logic from |
This will speedup image processing for many image formats. See: libvips/php-vips#33 (comment)
Thanks for the tip about Is there another way to get/calculate the buffer height in scanlines (scanline count)? I'm trying to implement the logic here in our resize function. |
Ooop, sorry for the pause. I'd use linecache instead, it does this for you internally. You want threaded mode, and sequential access. |
A user can now decide which page he wants for an PDF and TIFF. It even works for a multi-size ICO. Also, I’ve added a linecache before some operations. It seems to work (no `out of order read` error(s) anymore) but it will need some tweaking to find the correct `tile_height` before we’re going into production. See: libvips/php-vips#33
I will do some experiments with Outside the scope of this issue, but a function that I'm missing is For example, I've just implemented a page option to let the user decide which page he wants (useful for PDFs, TIFFs, and multi-size ICOs). If a user decides to use this function for a JPEG (or any other loader that doesn't support the page property) it will fail: |
@jcupitt Is there a method to clear the whole linecache (I tried See for the wrong trimmed image here and for the debug log here. From the debug log I can see that the Update: |
I'm going to close this issue. After testing with linecache I'm not getting any Sorry for the last 2 messages (it's too offtopic). I will create separate issues to track the |
To reduce memory usage and improve performance we did some tests with
sequential mode read
, from our tests in looks promising. However we're missing 1 function that is in libvips and not in the PHP binding:vips_get_tile_size
(some operations needs a tilecache to prevent over-computation)General question:
Sequential read mode does not work with
rotate
,sharpen
,gaussblur
and our trim function. If we have to deal with these operations we force the access mode toVIPS_ACCESS_RANDOM
, do you recommend this? I was not sure if a tilecache fixes this.The text was updated successfully, but these errors were encountered: