Req #21470 [Asn->Csd]: add imagecopyrotated from latest gd

From: Date: Sat, 21 Jan 2017 23:34:47 +0000
Subject: Req #21470 [Asn->Csd]: add imagecopyrotated from latest gd
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206826@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=21470&edit=1 ID: 21470 Updated by: cmb@php.net Reported by: gid at gifpaste dot net Summary: add imagecopyrotated from latest gd -Status: Assigned +Status: Closed Type: Feature/Change Request Package: GD related Operating System: Linux PHP Version: 4.3.0 Assigned To: pajoye Block user comment: N Private report: N New Comment: In my opinion, it wouldn't make sense to implement imagecopyrotated() in ext/gd, because it's not hard to implement it in userland using imagerotate() which produces results of far better quality than gdImageCopyRotated(). > […] ImageRotate fills the background with a given color -- > ImageCopyRotated will let the destination image show through the > transparent portions of the source, if any. You can choose a transparent color when using imagerotate() to achieve the same result. An example: <?php // red background $back = imagecreatetruecolor(150, 150); imagefilledrectangle($back, 0, 0, 149, 149, 0xff0000); // green foreground $front = imagecreatetruecolor(100, 100); imagefilledrectangle($front, 0, 0, 99, 99, 0x00ff00); // rotate foreground with transparent filling of missing pixels $front = imagerotate($front, 45, 0x7f000000); // copy foreground onto background imagecopy($back, $front, 5, 5, 0, 0, imagesx($front), imagesy($front)); // save composition: green diamond on red background imagepng($back, __DIR__ . '/21470.png'); Previous Comments: ------------------------------------------------------------------------ [2003-06-24 09:42:59] jmaki at andrew dot cmu dot edu I'd like to add my comments to this bug (to pajoye: it does say "feature request" under category, so this does seem to be an appropriate place for this) The built into non-php-gd version of ImageCopyRotated is nasty. It has really bad jagged edges and whatnot, and doesn't seem to do any cubic/linear sampling of the image at all. I think it'd be nice if somebody (maybe the author of ImageRotate?) could somehow alter the ImageRotate code to work with ImageCopyRotate. It's not as trivial as it sounds -- one can't just write a wrapper to ImageRotate where a new image is allocated for the caller -- ImageCopyRotate makes the distinction that if one is rotating an image on top of another image, ImageRotate fills the background with a given color -- ImageCopyRotated will let the destination image show through the transparent portions of the source, if any. I need such functionality for my app, and I can't seem to find a way with PHP without ImageCopyRotated. BTW, I did port the non-php-libgd version to PHP just for a try, and like I said before, the rotated image it makes is nasty. Somebody needs to make it use cubic or linear sampling like ImageRotate for better results... ------------------------------------------------------------------------ [2003-01-07 19:24:32] gid at gifpaste dot net the imagerotate() function is totally different from the imageCOPYrotated() function that I am referring to. imagerotate rotates an image imageCOPYrotate copys an image onto another image while rotating the image that we are copying. As far as I know, php doesn't allow access to the imageCOPYrotated function in gd > 2.0.8 ------------------------------------------------------------------------ [2003-01-07 17:35:55] pajoye@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. Hello, We strongly recommand the use of the bundled GD, which includes imagerotate. Thank's for your report. pierre ------------------------------------------------------------------------ [2003-01-06 14:14:23] gid at gifpaste dot net http://www.boutell.com/gd/ has a patch against php 4.2.3 that adds the imagecopyrotated() function from the gdImageCopyRotated() function that was added in gd 2.0.8. I would be nice if this were a part of the php tree. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=21470&edit=1

« previous php.bugs (#206826) next »