$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 图片 平均分割的更多相关文章

  1. Selective Search for Object Recognition 论文笔记【图片目标分割】

    这篇笔记,仅仅是对选择性算法介绍一下原理性知识,不对公式进行推倒. 前言: 这篇论文介绍的是,如果快速的找到的可能是物体目标的区域,不像使用传统的滑动窗口来暴力进行区域识别.这里是使用算法从多个维度对 ...

  2. [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 ...

  3. Halcon 彩色图片通道分割处理

    1.RGB通道:R红色,G绿色,B蓝色:R.G.B各占一个字节,取值范围在0—255:可代表的颜色数256*256*256==2^24 黑色区域是:R=G=B=0;   白色区域是:R=G=B=255 ...

  4. thinkphp3.2 图片平均颜色值

    public function imgColor($imgUrl) { $imageInfo = getimagesize($imgUrl); //图片类型 $imgType = strtolower ...

  5. js 平均分割

    let alllist=res.data; var result = []; for (var i = 0; i < alllist.length; i += 3) { result.push( ...

  6. 平均分割list

    private static List<List<Integer>> splitList(List<Integer> lists,int limit){ int s ...

  7. vue或者js中平均分割数组

    vue中 把一段长数组按照指定份数 均分 sliceArray(array, size) { var result = []; for (var x = 0; x < Math.ceil(arr ...

  8. android图片处理方法

    Java代码 //压缩图片大小 public static Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ...

  9. android图片处理方法(不断收集中)

    //压缩图片大小 public static Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ByteArr ...

随机推荐

  1. python gpio

    打算用python控制gpio,网上找的都是一些关于树莓派如何操作gpio的文档,只针对树莓派.所以就自己封装一下函数,方便以后使用.在linux上已经生成了和gpio相关的文件,只要对文件进行读取即 ...

  2. e825. 当JSplitPane改变大小时分配空间

    The weight of a split pane controls the behavior of the divider when the split pane is resized. If t ...

  3. java做web项目比较多

    WEB就是轻量级:如果要炫,FLEX或即将普及的html5.0都能做到像C/S那样. java做web项目比较多:如果是桌面程序,还是走C/S比较成熟. 如果是B/S架构的,后台还是JAVA,前台可以 ...

  4. (转)关于C++ const 的全面总结

    转自:http://blog.csdn.net/Eric_Jo/article/details/4138548 C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根 ...

  5. java EE 环境配置(JDK + Tomcat + Eclipse for java EE)

    这学期的课程多数都是java语言的,像Java Web程序设计,java课程设计案例,所以趁周末先把软件,环境配置好. 下载JDK 先给上下载链接:http://www.oracle.com/tech ...

  6. python shlex 模块

    shkex 模块最常见的用法就是其中的split 函数,split 函数提供了和shell 处理命令行参数时一致的分隔方式 代码示例: shlex.split("python -u a.py ...

  7. iOS:自定义字体

    转自: <iOS tips: Custom Fonts> Post by Steve Vlaminck My good friend google told me that using a ...

  8. SOA及分布式

    结合领域驱动设计的SOA分布式软件架构 Windows平台分布式架构实践 - 负载均衡(下) 分享一个分布式消息总线,基于.NET Socket Tcp的发布-订阅框架,附代码下载 我终于深入参与了一 ...

  9. VS2013启动浏览器链接(BrowserLink),导致页面脚本错误和页面加载变慢

    页面脚本出错场景:

  10. sql产生随机时间

    --建立过程 CREATE PROCEDURE GetTime     @BeginTime VARCHAR(5),     @EndTime VARCHAR(5),     @RandTime VA ...