Resize image to exact 64x64 Pixels
Posted: 2009-05-15T03:14:58-07:00
Hello !
I hope I can explain in my poor english what I would like to do.
I want to resize a picture to exactly 64x64 Pixels without loosing aspect ratio by cropping either the width or height.
- The aspect ratio should be kept
- If the height or width is greater than 64 the picture should be cropped from the center
- Important too: If a image is smaller than 64px it should be also resized (make bigger) to 64x64
I used this code before:
But it resizes sometimes only one side to 64 .. so you get 64x45 or something ...
Can somebody help me please ... any help is appreciated .. Thank you very much !
PS: This don't work for me .. which version do I need ? I have 6.2.4
I hope I can explain in my poor english what I would like to do.
I want to resize a picture to exactly 64x64 Pixels without loosing aspect ratio by cropping either the width or height.
- The aspect ratio should be kept
- If the height or width is greater than 64 the picture should be cropped from the center
- Important too: If a image is smaller than 64px it should be also resized (make bigger) to 64x64
I used this code before:
Code: Select all
$command = "/usr/bin/convert $resized -resize 50% +profile \"*\" ".$dest_folder."images/avatar/temp.jpg";
passthru($command);
$command = "/usr/bin/convert ".$dest_folder."images/avatar/temp.jpg -gravity Center -crop 64x64+0+0 +profile \"*\" $output";
passthru($command);
Can somebody help me please ... any help is appreciated .. Thank you very much !
PS: This don't work for me .. which version do I need ? I have 6.2.4
Code: Select all
widthxheight^ Minimum values of width and height given, aspect ratio preserved.