Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous.

RT 121302 - image insertion question - can't find documentation

  • 2 Replies
  • 675 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 356
    • View Profile
Sat Apr 22 20:51:28 2017 NHORNE [...] cpan.org - Ticket created
Subject:    image insertion question - can't find documentation

The image insertion seems to be done by

$image = $pdf->image_jpeg('foo.jpg);
$gfx = $page->gfx();
$gfx->image($image, $x, $y);

Guessing that x and y are co-ordinates on the page, are they the top left of the image, or bottom left, or centre, or somewhere else?  I can't find the documentation.

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 356
    • View Profile
Re: RT 121302 - image insertion question - can't find documentation
« Reply #1: April 23, 2017, 02:04:04 PM »
According to the latest POD:
Quote
Places an image on the page in the specified location (lower left corner of image).

If coordinate transformations have been made (see Coordinate Transformations above), the position and scale will be relative to the updated coordinates. Otherwise, [0,0] will represent the bottom left corner of the page, and $width and $height will be measured at 72dpi.

For example, if you have a 600x600 image that you would like to be shown at 600dpi (i.e., one inch square), set the width and height to 72. (72 Big Points is one inch)

An example from Content.pl:
Code: [Select]
# 40. image(): display an image, 640x480 scaled to 160x120

$grfx->translate($some_x, $some_y);

my $img_obj = $pdf->image_jpeg('examples\resources\aptfrontview.jpg');
$grfx->image($img_obj, 5,5, 160,120);  # scaled to 160Wx120H px, lower left at 5,5 offset from base

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 356
    • View Profile
Steve rejected RT 121303 as a duplicate of this bug.