PHP 图片 平均分割
$filename = 'D://WWW/1.jpg';
$p = 5;
// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width;
$newheight = floor($height / $p);
$last = $height % $p;
// Load
$source = imagecreatefromjpeg($filename);
for( $i=0 ; $i< $p; $i++ ){
$_p = $newheight*$i;
if( ( $i + 1 ) == $p )
$newheight += $last;
$thumb = ImageCreateTrueColor($newwidth, $newheight);
imagecopyresized( $thumb, $source, 0, 0, 0, $_p, $newwidth, $height, $width, $height);
imagejpeg( $thumb , "./t{$i}.jpg" ,100);
}
将图片平均分成几份。
PHP 图片 平均分割的更多相关文章
- Selective Search for Object Recognition 论文笔记【图片目标分割】
这篇笔记,仅仅是对选择性算法介绍一下原理性知识,不对公式进行推倒. 前言: 这篇论文介绍的是,如果快速的找到的可能是物体目标的区域,不像使用传统的滑动窗口来暴力进行区域识别.这里是使用算法从多个维度对 ...
- [CareerCup] 7.5 A Line Cut Two Squares in Half 平均分割两个正方形的直线
7.5 Given two squares on a two-dimensional plane, find a line that would cut these two squares in ha ...
- Halcon 彩色图片通道分割处理
1.RGB通道:R红色,G绿色,B蓝色:R.G.B各占一个字节,取值范围在0—255:可代表的颜色数256*256*256==2^24 黑色区域是:R=G=B=0; 白色区域是:R=G=B=255 ...
- thinkphp3.2 图片平均颜色值
public function imgColor($imgUrl) { $imageInfo = getimagesize($imgUrl); //图片类型 $imgType = strtolower ...
- js 平均分割
let alllist=res.data; var result = []; for (var i = 0; i < alllist.length; i += 3) { result.push( ...
- 平均分割list
private static List<List<Integer>> splitList(List<Integer> lists,int limit){ int s ...
- vue或者js中平均分割数组
vue中 把一段长数组按照指定份数 均分 sliceArray(array, size) { var result = []; for (var x = 0; x < Math.ceil(arr ...
- android图片处理方法
Java代码 //压缩图片大小 public static Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ...
- android图片处理方法(不断收集中)
//压缩图片大小 public static Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ByteArr ...
随机推荐
- Apache Commons CLI
简单的说,就是对命令的参数进行定义和解析的工具 -- 这里说的参数是我们常用的说法,而CLI里则是Option.Options,参数值(如果有)则是Option的arg(s). ## 为什么 那么,为 ...
- 关于Python的装饰器 decorator
装饰器的原理:其实就是高阶函数,接收原函数以在之前之后进行操作. 语法格式是固定的:先定义一个函数,再使用@语法调用该函数. 例子一: import functools # 定义装饰器,固定格式 de ...
- Oracle数据库的语句级读一致性
数据库:Oracle 前提:假定100万行的记录,在最后一行有一个数据a=1. 实验:你在9:00的时候查找数据,9:05的时候查到最后一行:但是,在9:01的时候有人修改了最后一行数据并提交(com ...
- SpringBoot系列八:SpringBoot整合消息服务(SpringBoot 整合 ActiveMQ、SpringBoot 整合 RabbitMQ、SpringBoot 整合 Kafka)
声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 1.概念:SpringBoot 整合消息服务 2.具体内容 对于异步消息组件在实际的应用之中会有两类: · JMS:代表作就是 ...
- python_程序模拟浏览器请求及会话保持
python下读取一个页面的数据可以通过urllib2轻松实现请求 import urllib2 print urllib2.urlopen('http://www.baidu.com').read( ...
- 某软件大赛C#版考题整理——【多选题】
二.多选题(20小题共40.0分) 1. 下列选项中,属于HTML按钮元素的是:(). A. <input name="btn" type="button" ...
- jquery 插件和后台模板搜集
弹框 alert confirmhttp://www.jq22.com/jquery-info2607 jQuery表格排序筛选插件http://www.jq22.com/jquery-info880 ...
- Nginx配置优化解读
全局配置 Nginx的配置文件是nginx的安装目录的conf/nginx .conf,nginx.conf配置文件中,几个全局高级配置在模块部分之上. user www www; worker_p ...
- u3d中 rect[2] == rt->GetGLWidth() && rect[3] == rt->GetGLHeight()错误的原因及解决方法
原文:http://blog.csdn.net/wolf96/article/details/38363161 官方是这么解释的 http://issuetracker.unity3d.com/iss ...
- Thinkphp5模板继承
代码 application\index\controller\index.php <?php namespace app\index\controller; use app\index\con ...