Re: [PHP] crop an image



Copying half a pixel? I dare say that's where the problem is.

Chrs,
Dav

On 31 Oct 2007, at 19:34, Merlin wrote:

Hi there,

I do have a small problem with the proportions of image copy

The image is originally vertical in 100px width and 141px height.
Now I want to crop it to 80 px width and 60px height. There should be no black area and the proportions should be OK. That means that I have to copy only part of the image. In this case it would be 40.5px from above (141-60 / 2 ) and until 100.5 (40.5+60).
This would crop the middle part of the image.

Now with imagecoyresampled I can set the starting point of 40.5px, but not the ending point. The image will have a black bottom.

Here is the code I am using:
imagecopyresampled($outputImg, $inputImg, 0,0, 0 , 40.5, 80, 60, $srcX, $srcY);

Thank you for any hint. Maybe somebody has a good idea on how to crop that image.

Best regards,

Merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

.



Relevant Pages

  • Re: [PHP] crop an image
    ... On 31 Oct 2007, at 19:34, Merlin wrote: ... Now I want to crop it to 80 px width and 60px height. ... There should be no black area and the proportions should be OK. ...
    (php.general)
  • crop an image
    ... Now I want to crop it to 80 px width and 60px height. ... There should be no black area and the proportions should be OK. ... Best regards, ...
    (php.general)
  • Re: Really stupid iTunes question
    ... >> same proportions as the original picture? ... > Photoshop - Image>Image Size, Constrain proportions, and set whatever size ... What I'm really talking about is when you crop a picture - I would love ... bellajonez at yahoo dot co dot uk ...
    (uk.comp.sys.mac)
  • Re: Really stupid iTunes question
    ... >>> Actually, WWH, how do you, either in Pshop or GC, crop an image to the ... >>> same proportions as the original picture? ... > it if the crop area could snap to proportions. ... Select the rectangle selection tool. ...
    (uk.comp.sys.mac)
  • Re: iMovie & iDVD alternatives?
    ... It would let me crop clips; I don't mean crop in time, ... stuff that came off video tape and the black area around letterboxed ... your long-obsolete versions of iMovie and iDVD. ...
    (comp.sys.mac.apps)