diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index b4323b4e..e77ad718 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -2872,13 +2872,30 @@ 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. Rendering uses the libpoppler library - * and should be fast. + * Render a PDF file into a VIPS image. Rendering uses the libpoppler library + * and should be fast. + * + * The output image is always RGBA --- CMYK PDFs will be + * converted. If you need CMYK bitmaps, you should use vips_magickload() + * instead. + * + * Rendering is progressive, that is, the image is rendered in strips equal in + * height to the tile height. If your PDF contains large image files and + * they span several strips in the output image, they will be decoded multiple + * times. To fix this, increase the the tile height, for example: + * + * |[ + * vips copy huge.pdf x.png --vips-tile-height=1024 + * ]| + * + * Will process images in 1024-pixel high strips, potentially much faster, + * though of course also using a lot more memory. * * 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 from the default 1 point == 1 pixel by @scale. + * you can scale the rendering from the default 1 point == 1 pixel by + * setting @scale. * * The operation fills a number of header fields with metadata, for example * "pdf-author". They may be useful. @@ -2886,7 +2903,7 @@ vips_matload( const char *filename, VipsImage **out, ... ) * This function only reads the image header and does not render any pixel * data. Rendering occurs when pixels are accessed. * - * See also: vips_image_new_from_file(). + * See also: vips_image_new_from_file(), vips_magickload(). * * Returns: 0 on success, -1 on error. */ diff --git a/libvips/foreign/pdfload.c b/libvips/foreign/pdfload.c index 77f32029..04414c3c 100644 --- a/libvips/foreign/pdfload.c +++ b/libvips/foreign/pdfload.c @@ -242,9 +242,10 @@ vips_foreign_load_pdf_generate( VipsRegion *or, r->left, r->top, r->width, r->height ); */ - /* Poppler won't always paint the background. + /* Poppler won't always paint the background. Use 255 (white) for the + * bg, PDFs generally assume a paper backgrocund colour. */ - vips_region_black( or ); + vips_region_paint( or, r, 255 ); surface = cairo_image_surface_create_for_data( VIPS_REGION_ADDR( or, r->left, r->top ), diff --git a/libvips/foreign/svgload.c b/libvips/foreign/svgload.c index a26f820d..67229efa 100644 --- a/libvips/foreign/svgload.c +++ b/libvips/foreign/svgload.c @@ -161,6 +161,10 @@ vips_foreign_load_svg_generate( VipsRegion *or, cairo_t *cr; int x, y; + /* rsvg won't always paint the background. + */ + vips_region_black( or ); + surface = cairo_image_surface_create_for_data( VIPS_REGION_ADDR( or, r->left, r->top ), CAIRO_FORMAT_ARGB32, @@ -431,7 +435,6 @@ vips_foreign_load_svg_buffer_class_init( { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; - VipsForeignClass *foreign_class = (VipsForeignClass *) class; VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class; gobject_class->set_property = vips_object_set_property;