x1nick Posted September 6, 2009 Share Posted September 6, 2009 I am having trouble resizing images in php. $new_image = imagecreatetruecolor($width, $height); # imageantialias($new_image,true); imagecopyresampled($new_image,$this->image,0,0,$x,$y,$width,$height,$new_width,$new_height); It works, just the end image is pixelated, tried with imageantialias and without. Still no joy. Its mainly pixelation around things, eg person on white background. The white would be pixelated. Some server info GD Version bundled (2.0.34 compatible) PHP Version 5.2.9 Any suggestions would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/173339-imagecopyresampled-pixelation/ Share on other sites More sharing options...
x1nick Posted September 6, 2009 Author Share Posted September 6, 2009 Here is a example of a resized picture. You can see around the arms the slight pixelation Quote Link to comment https://forums.phpfreaks.com/topic/173339-imagecopyresampled-pixelation/#findComment-913712 Share on other sites More sharing options...
Alex Posted September 6, 2009 Share Posted September 6, 2009 You shouldn't be using JPEG format images if you don't want that to occur. This isn't a code issue. Idealy you should be using PNG or another lossless image format. JPEG isn't lossless so every time it's processed it tends to get messed up. Quote Link to comment https://forums.phpfreaks.com/topic/173339-imagecopyresampled-pixelation/#findComment-913720 Share on other sites More sharing options...
Daniel0 Posted September 6, 2009 Share Posted September 6, 2009 Try setting quality=100 when calling imagejpeg. By the way, it's called JPEG artifacts, not pixelation. That's something different. Pixelation is when the individual pixels in a picture is visible to the human eye. That's not the case here. JPEG artifacts occur because JPEG is using lossy compression, like AlexWD said. Quote Link to comment https://forums.phpfreaks.com/topic/173339-imagecopyresampled-pixelation/#findComment-913730 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.