vipsthumbnail knows about pdfload

woo, fast!
This commit is contained in:
John Cupitt 2016-02-09 09:26:54 +00:00
parent 8ffbe98a29
commit 625e0fbd9e
3 changed files with 33 additions and 3 deletions

View File

@ -3,6 +3,7 @@
- vips_resize() and vips_similarity() use it when they can
- bicubic is better on 32-bit int images
- add pdfload for PDF rendering ... file and buffer input are supported
- vipsthumbnail knows about pdfload
27/1/16 started 8.2.3
- fix a crash with SPARC byte-order labq vips images

View File

@ -2863,12 +2863,13 @@ vips_matload( const char *filename, VipsImage **out, ... )
* @dpi: %gdouble, render at this DPI
* @scale: %gdouble, scale render by this factor
*
* Render a PDF file into a VIPS image.
* Render a PDF file into a VIPS image. Rendering uses the libpoppler library
* and should be fast.
*
* Use @page to select a page to render, numbering from zero.
*
* Use @dpi to set the rendering resolution. The default is 72. Alternatively,
* you can scale the rendering by @scale.
* you can scale the rendering from the default 1 point == 1 pixel by @scale.
*
* The operation fills a number of header fields with metadata, for example
* "pdf-author". They may be useful.

View File

@ -70,6 +70,8 @@
* - premultiply alpha
* 30/7/15
* - warn if you autorot and there's no exif support
* 9/2/16
* - add PDF --size support
*/
#ifdef HAVE_CONFIG_H
@ -274,8 +276,34 @@ thumbnail_open( VipsObject *process, const char *filename )
NULL )) )
return( NULL );
}
else if( strcmp( loader, "VipsForeignLoadPdfFile" ) == 0 ) {
double shrink;
/* This will just read in the header and is quick.
*/
if( !(im = vips_image_new_from_file( filename, NULL )) )
return( NULL );
shrink = calculate_shrink( im );
g_object_unref( im );
vips_info( "vipsthumbnail",
"loading PDF with factor %g pre-shrink",
shrink );
/* We can't use UNBUFERRED safely on very-many-core systems.
*/
if( !(im = vips_image_new_from_file( filename,
"access", VIPS_ACCESS_SEQUENTIAL,
"scale", 1.0 / shrink,
NULL )) )
return( NULL );
}
else {
/* All other formats.
/* All other formats. We can't use UNBUFERRED safely on
* very-many-core systems.
*/
if( !(im = vips_image_new_from_file( filename,
"access", VIPS_ACCESS_SEQUENTIAL,