# 2.19 PHPGD

## 简介

GD库是php处理图形的扩展库，GD库提供了一系列用来处理图片的API，使用GD库可以处理图片，或者生成图片，也可以给图片加水印。

在网站上GD库通常用来生成缩略图，或者用来对图片加水印，或者用来生成汉字验证码，或者对网站数据生成报表等。在PHP处理图像，可使用GD库，而GD库开始时是支持GIF的，但由于GIF使用了有版权争议的LZW算法，会引起法律问题，于是从 GD 库 1.6 版起所有的 GIF 支持都移除了，但是又在 GD 库 2.0.28 版起又加了回来。如果使用二者之间版本的 GD 库时 GIF 相关函数不可用。

![](https://i.screenshot.net/meoknbp)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ninjia.gitbook.io/secskill/serve/phpgd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
