gd

How to Improve my php image resizer to support alpha png and transparent GIFs

喜你入骨 提交于 2019-12-21 23:30:45
问题 I use this function to resize images but i end up with ugly creepy image with a black background if it's a transparent GIF or PNG with alpha, however it works perfectly for jpg and normal png. function cropImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; }

draw binary tree with php

非 Y 不嫁゛ 提交于 2019-12-21 18:05:22
问题 I'm looking for a good library / API to draw a binary tree using PHP. I've tried using Image_GraphViz, but it doesn't seem to work. I've also looked at phpsyntaxtree, but its not documented. Alternatively, I'm also looking for a jQuery plugin that does this. (just not this one because it has no documentation). Thanks 回答1: My suggestion is to go with js, because vector graphs are nicer and you can add interactivity anytime. Try raphael, a good (and perfectly documented) js graph library

how to detect shape in a image with php?

巧了我就是萌 提交于 2019-12-21 17:50:02
问题 I have to detect 'star' like shape in a image with php.Also the star is not fixed and may be at other position next time.I cannot use any external software or library.I have tried all methods like edge detection and grayscaling but all in vain.this is the image: the main problem is I cannot clear the background. if image background is cleared than i can read all pixels color row wise as well as column wise and detect.please help me.this is the image after brightness_filter and edge detection.

Create an animated .gif from .jpeg/png

 ̄綄美尐妖づ 提交于 2019-12-21 12:30:59
问题 Is it possible to use the GD library to create an animated gif? I want the user to upload a png/jpeg and generate a 2 frame animated gif out of the image. Thanks 回答1: There is a good post about it on SO : Create Animated Gif with Jpeg Images You can't do it with GD Functions, but there is a class on phpclasses.org to do this, check that : PHP Classes GIF Animation From You can also find a good tutorial about it here : Tutorial Generate Animated GIF PHP 回答2: The question is old but here a new

sharpen image quality with PHP gd library

霸气de小男生 提交于 2019-12-21 05:11:10
问题 not sure where but I came across as image hosting site that allows you to upload your image in a large format or to sharpen it. I personally do not recall or know of any functions of GD library to sharpen image which might just be a different word for quality being up-ed. If some one knows of a function to sharpen images please tell me since personally I am not aware of such functions neither in Image Magic and/or GD Library. Thanks in advance 回答1: You'd use imageconvolution() with a matrix

Installing GD library for perl on MacOSX 10.6

懵懂的女人 提交于 2019-12-21 04:52:14
问题 I have been trying to install GD library for perl to no avail a long while now. I've tried every little thing I could find on the internets but nothing. I am trying to get Circos graphs which require the GD package. When I try to install it through CPAN it gives me this error: Running make test PERL_DL_NONLAZY=1 /usr/bin/perl/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/GD.t ........ 1/12 Can't load './blib/arch/auto/GD/GD.bundle' for module GD:

PHP GD Text with Transparency/Alpha background

99封情书 提交于 2019-12-21 04:38:20
问题 alright so im having a problem with getting my text layed over a partly transparent image. i want the text to be solid, but i want part of the background of the image to be transparent, and the part the text is over to be solid, which i have, the problem is the text is inheriting the transparent background of one of the previous layers. here is the code, and an example of the output, and under that output what i want it to look like. the image is laying on a light grey background so the light

Merge a png ontop of a jpg and retain transparency with php

拈花ヽ惹草 提交于 2019-12-20 14:42:37
问题 I have a PNG and I'm trying to merge it on top of a JPG. With the following code $dest = imagecreatefromjpeg("example.jpg"); $src = imagecreatefrompng("example.png"); imagealphablending($dest, false); imagesavealpha($dest, true); imagealphablending($src, true); imagecopymerge($dest, $src, $src2x, $src2y, 0, 0, $src2w, $src2h, 100); header('Content-Type: image/png'); imagepng($dest, "user/".$imei."/".$picCount."_m"); imagedestroy($dest); imagedestroy($src); Results in the following I also

Crop image in circle (php)

前提是你 提交于 2019-12-20 12:39:12
问题 The following code works on my laptop but doesn't work on remote server: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); $filename = "../../content/".base64_decode($_GET["file"]); $ext = pathinfo($filename, PATHINFO_EXTENSION); if ($ext=="jpg" || $ext=="jpeg") { $image_s = imagecreatefromjpeg($filename); } else if ($ext=="png") { $image_s = imagecreatefrompng($filename); } $width = imagesx($image_s); $height = imagesy($image_s); $newwidth = 285; $newheight = 232; $image =

ImageMagick or GD Library for image resizing and thumbnail creation?

瘦欲@ 提交于 2019-12-20 07:39:13
问题 I had been using the image resize class written by someone else to resize images or to create the thumbnails, here is the link to the class I had been using. http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php I guess image GD library has some limitations for the resolution or the file size of images, it works fine for low resolution picture resizing(below 1024px) but it does not resize if I try to upload the high resolution jpeg image (i.e 3400px X 2200px) roughly, The