CodeIgniter Forums
image resize makes image look bad. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: image resize makes image look bad. (/showthread.php?tid=5997)



image resize makes image look bad. - El Forum - 02-11-2008

[eluser]Unknown[/eluser]
I'm letting people upload images and want the images to be a certain height/width if they go over a certain size. The problem is once resized, the image looks bad. It looses most of the color and just has a black/white, brown tone to it. Here's the code:


$this->upload->do_upload($image);
$info=$this->upload->data();

$config['image_library'] = 'GD';
$config['source_image'] = $info['full_path'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 150;
$config['height'] = 214;
$config['quality']="100%";

$this->load->library('image_lib', $config);
$this->image_lib->resize();

Am I missing something?

Thanks!


image resize makes image look bad. - El Forum - 02-11-2008

[eluser]tmcw[/eluser]
GD has inferior antialiasing compared to GD2 or ImageMagick. Have you tried either of those? I think GD2 is standard since PHP 4.3 or so...


image resize makes image look bad. - El Forum - 03-04-2008

[eluser]Merolen[/eluser]
Changing to GD2 really did the trick. I made a resizing class using only GD once and I used

Code:
$this->modifImage = imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($this->modifImage,$this->origImage,0,0,0,0,$newwidth,$newheight,$oldx,$oldy);

which also works