Page 1 of 1

cropping problems

Posted: 2010-09-18T17:46:04-07:00
by jammyjames
Hi,

I found this forum in a frantic rush to try and finally solve the problem I have.

I am trying to crop an image using Imagemagick: http://pastebin.com/1ZKgHWLk

The code I have written to do this: http://pastebin.com/Cr7qDj3J does everything & crops the image BUT it outputs a black image.

I have tried everything to try and resolve. Im sure it's something simple BUT I can't figure out what it is.

Does anyone have any ideas?

Thanks!

Re: cropping problems

Posted: 2010-09-18T20:47:56-07:00
by fmw42
Perhaps you need to remove the virtual canvas after cropping. See http://us3.php.net/manual/en/function.i ... gepage.php

Re: cropping problems

Posted: 2010-09-19T09:27:35-07:00
by el_supremo
If I read it correctly, you aren't loading the image into memory. load_image only pings the image. You should use _load_image

Pete

Re: cropping problems

Posted: 2010-09-19T11:02:40-07:00
by jammyjames
Thanks guys for replying.

Pete, I thought the same and tried _load_image but when I do use this it throws an error: Resource Id: ... does not exist

Any ideas? The absolute file path it references does seem to be correct.

Thanks for your help.

Re: cropping problems

Posted: 2010-09-19T11:23:46-07:00
by Bonzo
Start simple, get it working and then add all the posts etc.

Code: Select all

<?php

$im = new imagick( "input.jpg" );
 
$im->cropImage( 100, 100, 50, 50 );
 
$im->writeImage( "thumbnail.jpg" );
?> 
	
<img src="th_80x80_test.png">

Re: cropping problems

Posted: 2010-09-19T12:22:48-07:00
by jammyjames
Thanks

I don't know what I decided to use a custom class.

The code you offered is fine. A problem out the way.
Thanks again.