PHP 处置图片
Jun 13, 2016 pm 12:48 PM
100
200k
jpg
PHP 处理图片
有个上传图片的功能
如何每次把上传的图片大小控制在200K以下?
只能更改图片的尺寸吗?
其实图片的像素和尺寸和清晰度等都有什么联系。。
------解决方案--------------------
可以的。尺寸会影响大小。
------解决方案--------------------
控制一下压缩比例,因为有的图片像素太大的话,比例缩略到指定比例也不一定会小于200k,所以要控制你最大上传图片的大小缩略到200k的最佳比例...
------解决方案--------------------
从目前流行的图片采集设备上看,200K 只不过是一张普通邮票
清晰度是指表示已知大小的目标所耗费的像素素,当然是越多越清晰
比如,头发的直径约在70~100μm之间
你用一个像素表示,那么只是一条细线
你用100个像素表示的话,你将能看到发身上的鳞片
------解决方案--------------------
像素和图片尺寸的关系是单元和总体的关系
像素和图片文件尺寸(字节数)的关系我在#2说了
一幅1024x500像素的无损全彩(24bit)图片就是1500k再加文件头,jpg(非jpg2000)就大概是无损的1/6约250k
说“大概”,“约”是因为jpg有多级压缩率,每像素的颜色值也有影响,故字节数不定
同样像素的“万花筒”和纯色图片,均使用24bit采样,两者无损图片格式的字节数一样,但jpg格式后者字节数就小很多
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?
3 weeks ago
By 王林
Two Point Museum: All Exhibits And Where To Find Them
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?
3 weeks ago
By 王林
Two Point Museum: All Exhibits And Where To Find Them
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to convert PNG to JPG on Windows 11

Fix: Can't open JPG files in Windows 11

Let's talk about how to use php to easily convert WebP to JPG.

How to rename the extension of all files within a folder, including subfolders
