gd

GD Quality Issue with Transparent PNGs

半世苍凉 提交于 2019-12-20 07:34:50
问题 I'm getting some very bad quality using GD to resize some PNGs. If I don't resize them, it seems fine, and if I use GD's negate filter, it seems fine as well, which is very weird. But nothing else seems to help. This is happening with timthumb (latest) and aq_resize for wordpress. Here is one image, processed with timthumb: http://cdn.squidix.com/images/branding/name-white.png?h=150 The original of this image is white text over a transparent background. The white text has no border, it just

GD Quality Issue with Transparent PNGs

筅森魡賤 提交于 2019-12-20 07:34:39
问题 I'm getting some very bad quality using GD to resize some PNGs. If I don't resize them, it seems fine, and if I use GD's negate filter, it seems fine as well, which is very weird. But nothing else seems to help. This is happening with timthumb (latest) and aq_resize for wordpress. Here is one image, processed with timthumb: http://cdn.squidix.com/images/branding/name-white.png?h=150 The original of this image is white text over a transparent background. The white text has no border, it just

Combining images in PHP while retaining transparency

♀尐吖头ヾ 提交于 2019-12-20 05:45:48
问题 Have a look here: http://tyilo.jbusers.com/PNG/progress.php?l=100&p=20 I want to remove the white-thingy at the end of the blue part, but I have tried many different things that didn't work. If needed the pngs can be found in http://tyilo.jbusers.com/PNG/ folder (http://tyilo.jbusers.com/PNG/Empty.png) header('Content-type: image/png'); echo imagepng(progressbar($_GET['l'], $_GET['p'])); function progressbar($length, $percentage) { $length = round($length / 2) * 2; $percentage = min(100, max

Intervention imagick works in terminal but not in browser

霸气de小男生 提交于 2019-12-20 05:39:40
问题 I quite don't understand what's going wrong. I've installed Intervention from as guided here Then I created the following .php file and started my localhost Apache server and tested the results and it worked! Here's the code: test.php <?php require 'vendor/autoload.php'; use Intervention\Image\ImageManagerStatic as Image; Image::configure(array('driver' => 'gd')); $image = Image::make('ar.jpg'); $path = 'public/images/photoh.png'; $image->save($path); ?> But when I run the same file using php

Quickly get brightness / luminosity of images

时光总嘲笑我的痴心妄想 提交于 2019-12-20 05:28:08
问题 I'm working in php, and going through each image pixel-by-pixel to get an average brightness for each image is going to be way to cpu intensive... I've looked through both GD and imagemagick docs, but haven't found a way to return the average brightness of an image... Can this be done quickly either in these libraries, or in another package easily accessible by php? 回答1: Here is an interesting post using ImageMagick for computing the average graylevel of an image. This post also discusses

PHP GD - transparent PNG black background

帅比萌擦擦* 提交于 2019-12-20 04:38:13
问题 I am using PHP and GD to crop and output an image with the code below. it works fine but when i pass a transparent PNG into it i get a black background generated. How can i stop this? //setup switch ($source_type) { case IMAGETYPE_JPEG: $source = imagecreatefromjpeg($img_path); break; case IMAGETYPE_PNG: $source = imagecreatefrompng($img_path); break; } // setup cropped destination $cropped = imagecreatetruecolor($cropped_width, $cropped_height); // create cropped image $x = (($source_width /

How to rotate an image in GD Image Library while keeping transparency?

强颜欢笑 提交于 2019-12-20 04:31:08
问题 I'm making a skin previewer for my site; I need to rotate parts of an image to create a representation of this for my users to see. The skin is a PNG file, and all parts of it may have transparency or even none at all. I need to be able to rotate this image while keeping any transparency inside the image transparent, while also having the extended borders (You know, the area that wasn't part of the image before it was rotated) transparent. All of my attempts have left a black border around

PHP GD issues with ImageCreateTrueColor and PNGs

对着背影说爱祢 提交于 2019-12-20 04:30:50
问题 I am resizing PNG images using the GD image library function ImageCopyResampled(). It all works fine, I can even keep alpha blending transparency with the use of ImageCreateTrueColor() rather than using ImageCreate() to create the resized image. The problem is, that if I use ImageCreateTrueColor() rather than ImageCreate() the file size of PNG files increases from something like 80kb to 150kb. If I use ImageCreate() the file size stays around the same size, but colors screw! So my question is

Accented characters not showing when using imagettftext with otf but showing with ttf

∥☆過路亽.° 提交于 2019-12-20 04:29:08
问题 I'm using imagettftext to generate images from OpenType files. Everything works until I try to use an accented character (e.g. å) or a character such as √. In their place I get the .notdef glyph. The fonts I'm using definitely have these characters. To make things even more frustrating, when I use a TTF everything works as expected. Any ideas? Thanks 回答1: Sorry to tell you, but PHP OTF supports only standard Ascii characters. It's a well known fact that special characters in OTF only very

Portrait Images are being rotated to 270 degrees clockwise by codeigniter resize library

試著忘記壹切 提交于 2019-12-20 03:54:11
问题 Whenever I am uploading an image and displaying it using image tag/ background image property, The image is automatically being rotated to 270 degrees clockwise, But when I open the image in a new window it is coming correctly. I tried to display an image using a simple image tab with basic styles, but if the image is in portrait mode, it is converting it to landscape When I tried to resize it using codeignitor resize library( GD2 ), It is behaving the same way as HTML( rotating the resulting