joomla/joomla-cms — pull request #2116 by piotr-cz (2013-10-02 20:49:20+00:00)
Title: JImage: drop incorrect use of imagecopyresize

There was a invisible bug in the `resize` method that showed up when I've implemented [IMAGE_FIT](https://github.com/joomla/joomla-cms/pull/1565) functionality.

The class didn't evaluate loaded image be transparent ([see fix](https://github.com/joomla/joomla-framework/pull/223/files#L0R642)) and thus was always using [`imagecopyresampled`](https://github.com/joomla/joomla-framework/blob/staging/src/Joomla/Image/Image.php#L701) function and everything seemed alright.

After the patch resource handle is evaluated to be transparent and `imagecopyresized` method produces visually poor results.

After little research I'm not sure, why it's even been used; I hope the author @rvsjoen can say something about it.
It seems that `imagecopyresized` is quite faster, but still would be used for wrong reasons.

Other frameworks:
- [Lavarell Resizer bundle uses](https://github.com/maikeldaloo/Resizer/blob/master/resizer.php#L133) just `imagecopyresampled`
- Symfony [too](http://trac.symfony-project.org/browser/plugins/sfImageTransformPlugin/branches/2.0/lib/transforms/GD/ImageTransformResizeSimpleGD.class.php#L60)
- Kohana [as well](https://github.com/kohana/image/blob/3.3/master/classes/Kohana/Image/GD.php)

Resources:
- TuxRadar: [Scaling and rotating](http://www.tuxradar.com/practicalphp/11/2/12)
- StackOverflow: [php imagecopyresized vs imagecopyresampled](http://stackoverflow.com/questions/18004702/php-imagecopyresized-vs-imagecopyresampled-vs-imagecopy-pros-cons)
- php.blogle.info: [Performance comparison](http://www.php.blogle.info/2010/funkcje-biblioteki-rozszerzenia/php-a-grafika/wydajnosc-funkcji-imagecopyresampled-i-imagecopyresized/)
- random search [result showing difference in quality](http://blog.vexer.ru/post53115076)