gd

imagecopymerge_alpha converting my overlay to dest img's colors?

感情迁移 提交于 2020-01-07 03:17:09
问题 Code: <?php header("Content-type: image/png"); $hue = rand(0, 360); $sat = rand(80,100); $lum = rand(50,100); $hue /= 360; $sat /= 100; $lum /= 100; $result = ColorHSLToRGB($hue, $sat, $lum); $col1 = sprintf('%02x', $result['r']) . sprintf('%02x', $result['g']) . sprintf('%02x', $result['b']); $hue2 = $hue + ((mt_rand() / mt_getrandmax()) / 10) - 0.5; $sat2 = $sat + ((mt_rand() / mt_getrandmax()) / 10) - 0.5; $lum2 = $lum + ((mt_rand() / mt_getrandmax()) / 10) - 0.5; $result2 = ColorHSLToRGB(

Recommendation for real time image processing tools on Linux [closed]

核能气质少年 提交于 2020-01-06 11:08:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm trying to find a real time image processing tool that can do image resizing, image/text overlaying and format converting. I found some related posts but they don't quite answer my question. Prioritized criteria for the tool: The processing time needs to be less than 100 ms. The size of output image needs to

Recommendation for real time image processing tools on Linux [closed]

↘锁芯ラ 提交于 2020-01-06 11:08:19
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm trying to find a real time image processing tool that can do image resizing, image/text overlaying and format converting. I found some related posts but they don't quite answer my question. Prioritized criteria for the tool: The processing time needs to be less than 100 ms. The size of output image needs to

Recommendation for real time image processing tools on Linux [closed]

删除回忆录丶 提交于 2020-01-06 11:07:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm trying to find a real time image processing tool that can do image resizing, image/text overlaying and format converting. I found some related posts but they don't quite answer my question. Prioritized criteria for the tool: The processing time needs to be less than 100 ms. The size of output image needs to

How can I overlay a watermark on an already resampled image in PHP (using GD)?

﹥>﹥吖頭↗ 提交于 2020-01-06 08:27:12
问题 Here's my current code: define('IMG_WIDTH', (isset ($_GET['width'])) ? (int) $_GET['width'] : 99); define('IMG_HEIGHT', (isset ($_GET['height'])) ? (int) $_GET['height'] : 75); $image = imagecreatefromjpeg($_GET['image']); $origWidth = imagesx($image); $origHeight = imagesy($image); $croppedThumb = imagecreatetruecolor(IMG_WIDTH, IMG_HEIGHT); if ($origWidth > $origHeight) { $leftOffset = ($origWidth - $origHeight) / 2; imagecopyresampled($croppedThumb, $image, 0, 0, $leftOffset, 0, IMG_WIDTH,

A border appears when rotating image with gd + php

情到浓时终转凉″ 提交于 2020-01-05 04:57:13
问题 A border appears when rotating image with gd + php and I do not know what I did wrong. <?php $size = 900; $img = imagecreate($size, $size); imagesavealpha($img, true); $color = imagecolorallocatealpha($img, 0, 0, 0, 127); imagefill($img, 0, 0, $color); $lines_color = imagecolorallocate($img, 0, 0, 0); imageline($img, ($size * 0.50), ($size * 0.00), ($size * 0.50), ($size * 1.00), $lines_color); imageline($img, ($size * 0.20), ($size * 0.00), ($size * 0.80), ($size * 1.00), $lines_color);

crop an image after resizing in GD library

纵饮孤独 提交于 2020-01-05 02:58:06
问题 I need to first resize an image proportionally (the width is the important dimension) and then crop afterwards to chop of any excess height and then store the new version in a directory. I've managed to do the resizing fine and I end up with images that are the correct width in my directory. Somehwere in here I need to crop the excess height off. But I can't work out where I need to do it. Do I need to use copyimageresampled somehow. I want to crop all images so they're 50px in height. Here's

PHP - Problem with ImageCopyResampled

青春壹個敷衍的年華 提交于 2020-01-04 14:35:42
问题 It's my first time using the function ImageCopyResampled. I just followed the code written in the PHP manual. There seemed to be no errors when I ran the code. The problem is my code just basically copies the original image and did not follow the dimensions as it was defined in the parameters passed in the function. Below is my code: public static function uploadFile($filename, $x_dimension, $y_dimension, $width, $height){ $file = DOCROOT . "uploads/temp/".$filename; $trgt_file = DOCROOT .

php imagerotate() ruins alpha on png?

爱⌒轻易说出口 提交于 2020-01-04 04:28:05
问题 I've been bashing my head agains something simple.. // ....all prev code is fine.... $pasteboard =imagecreatetruecolor($imgs['bg']["width"],$imgs['bg']["height"]); imagealphablending($pasteboard, false); imagecopyresampled($pasteboard, $imgs['bg']["img"],0,0,0,0,$imgs['bg']["width"],$imgs['bg']["width"],imagesx($imgs['bg']["img"]),imagesy($imgs['bg']["img"])); imagecopyresampled($pasteboard, $imgs['photo']["img"],20,20,0,0,$imgs['photo']["width"],$imgs['photo']["width"],imagesx($imgs['photo']

Why does this basic imagejpeg() resizer returns a black image?

白昼怎懂夜的黑 提交于 2020-01-04 04:07:04
问题 EDIT Thanks for all your answers, especially @Mailerdaimon who noticed that I wasn't using the computed values in the imagecopyresampled function. I don't get black images anymore, but i still do get some black part so i figure my ratio formula should be updated : if i upload a landscape image, the height of the new image is smaller than 170px, and then there's some black showing. How can i make sure the height of the image goes all the way ? Below is a simple script to allow users upload