Questions tagged [gd]

GD Library is used to dynamically create and manipulate image files.

GD is an acronym for GIF Draw, GD is an open source code library for the dynamic creation of images by programmers. GD is written in , and "wrappers" are available for Perl, PHP and other languages. GD creates , and images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. While not restricted to use on the web, the most common applications of GD involve website development.

2868 questions
106
votes
10 answers

Can PNG image transparency be preserved when using PHP's GDlib imagecopyresampled?

The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128. It works great, except that the transparent areas in the original image are being replaced with a solid color- black in my case. Even though imagesavealpha is set,…
Cheekysoft
  • 32,898
  • 19
  • 70
  • 85
91
votes
2 answers

GD vs ImageMagick vs Gmagick for jpg?

I am in the step to abandon GD for manipulating image in my website - it is awful. Everyone saying to use ImageMagick because they are better than GD, but what about ImageMagick vs Gmagick (Swiss Army knife of image processing)? Zend has a pretty…
dynamic
  • 44,025
  • 53
  • 143
  • 223
84
votes
9 answers

Efficient JPEG Image Resizing in PHP

What's the most efficient way to resize large images in PHP? I'm currently using the GD function imagecopyresampled to take high resolution images, and cleanly resize them down to a size for web viewing (roughly 700 pixels wide by 700 pixels…
maxsilver
  • 4,184
  • 4
  • 24
  • 23
81
votes
11 answers

imagecreatefromjpeg and similar functions are not working in PHP

I’ve searched for this and the solutions provided in past questions are completely incomprehensible to me. Whenever I run functions like imagecreatefromjpeg, I get this: Fatal error: Call to undefined function imagecreatefromjpeg() ... I’m working…
UserIsCorrupt
  • 4,151
  • 14
  • 35
  • 41
66
votes
17 answers

Extension gd is missing from your system - laravel composer Update

I newly install Dompdf in Laravel Project via Composer (composer require barryvdh/laravel-dompdf). After enter the Command Terminal Reply Following Errors. Problem 1 - dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is…
Karthik
  • 4,583
  • 12
  • 36
  • 65
64
votes
6 answers

install php70-gd on ubuntu

Recently the new php7 has been released. However, when I am trying to install the gd package, the library can not be found. I have tried through sudo apt-get install php70-gd and sudo apt-get install php70-php-gd Does anybody have an idea if gd…
apfz
  • 310
  • 3
  • 21
  • 52
63
votes
8 answers

Crop image in PHP

The code below crops the image well, which is what i want, but for larger images, it wotn work as well. Is there any way of 'zooming out of the image' Idealy i would be able to have each image roughly the same size before cropping so that i would…
user195257
  • 2,592
  • 5
  • 32
  • 47
59
votes
9 answers

Enabling/installing GD extension? --without-gd

How does one enable (or perhaps I need to install) GD when my phpinfo() output in "Configure Command" says; --without-gd ? I also have nothing in my phpinfo() output "Core" that lists "gd" PHP Version 5.2.4 on AWS.
Shu
  • 591
  • 1
  • 4
  • 3
54
votes
1 answer

php imagecopyresized vs imagecopyresampled vs imagecopy pros/cons

These all seem to do the same thing. What are the pros/cons of each. imagecopyresized() vs imagecopyresampled() vs imagecopy(). I'm resizing a user submitted image. So I have an image shell created with '$newImage=imagecreatetruecolor(250,…
seamus
  • 1,949
  • 4
  • 22
  • 33
51
votes
6 answers

CentOS: Enabling GD Support in PHP Installation

How do I go about enabling GD Support in a CentOS Installation?
AKKAweb
  • 3,717
  • 4
  • 29
  • 59
45
votes
6 answers

Can I detect animated gifs using php and gd?

I'm currently running into some issues resizing images using GD. Everything works fine until i want to resize an animated gif, which delivers the first frame on a black background. I've tried using getimagesize but that only gives me dimensions and…
Kris
  • 36,072
  • 8
  • 69
  • 94
43
votes
3 answers

ImageMagick vs GD - which is faster, less resource intensive and produces better images?

I need to choose between either ImageMagick or GD library for the following image manipulation tasks: resizing images into multiple sizes watermarking images As you can see I don't need anything fancy. I'm sure both these tools can achieve them,…
user967451
43
votes
10 answers

How do I resize pngs with transparency in PHP?

I'm attempting to resize pngs with transparent backgrounds in PHP and the code samples I've found online don't work for me. Here's the code I'm using, advice will be much appreciated! $this->image =…
Ryan Doherty
  • 37,071
  • 3
  • 51
  • 62
41
votes
6 answers

PHP GD Use one image to mask another image, including transparency

I am trying to create a PHP script that takes an image: http://i.stack.imgur.com/eNvlM.png and then applies a PNG image: http://i.stack.imgur.com/iJr2I.png as a mask. The end result needs to maintain…
Matt
  • 413
  • 1
  • 4
  • 4
41
votes
8 answers

imagecreatefrompng() Makes a black background instead of transparent?

I make thumbnails using PHP and GD library but my code turn png transparency into a solid black color, Is there a solution to improve my code? this is my php thumbnail maker code: function cropImage($nw, $nh, $source, $stype, $dest) { $size =…
Emily
  • 875
  • 3
  • 10
  • 13
1
2 3
99 100