small fixes

use 255 for PDF background
This commit is contained in:
John Cupitt 2016-02-10 15:19:00 +00:00
parent 0081f5e4ef
commit 9f2da7d0ee
3 changed files with 28 additions and 7 deletions

View File

@ -2875,10 +2875,27 @@ vips_matload( const char *filename, VipsImage **out, ... )
* 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.
*/

View File

@ -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 ),

View File

@ -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;