$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. (笔记)Mysql实例:建库建表并插入数据2

    drop database if exists school;  // 如果存在SCHOOL则删除create database school;  // 建立库SCHOOLuse school;  / ...

  2. elasticsearch系列三:索引详解(分词器、文档管理、路由详解(集群))

    一.分词器 1. 认识分词器  1.1 Analyzer   分析器 在ES中一个Analyzer 由下面三种组件组合而成: character filter :字符过滤器,对文本进行字符过滤处理,如 ...

  3. e810. 创建弹出菜单

    final JPopupMenu menu = new JPopupMenu(); // Create and add a menu item JMenuItem item = new JMenuIt ...

  4. e778. 在JList中加入和删除项

    The default model for a list does not allow the addition and removal of items. The list must be crea ...

  5. CSS3 3D立方体翻转菜单实现教程

    今天我们来看一个非常有创意的CSS3 3D菜单,这个菜单的菜单项是可以旋转的长方体,鼠标滑过是长方体即可旋转,看看下面的效果图,是不是感觉非常酷,我觉得这个菜单很适合用在咱们开发人员的个人网站上. 当 ...

  6. Android 监听屏幕唤醒和关闭的广播

    今天希望应用程序的服务运行时,可以监听到屏幕的唤醒.继续百度学习法,连同监听闭幕关闭也一同学习了. 此种情况需要动态注册系统广播.在AndroidManifest.xml中静态注册的实际运行中无效. ...

  7. UpdateData()用法

    一.总结UpdateData()函数 UpdateData(true);//用于将屏幕上控件中的数据交换到变量中. UpdateData(false);//用于将数据在屏幕中对应控件中显示出来.    ...

  8. CSS 文本缩进,行间距

    文本缩进:text-indent:2.0em; 行间距:line-height:1.5em;

  9. 用python将MSCOCO和Caltech行人检测数据集转化成VOC格式

    代码:转换用的代码放在这里 之前用Tensorflow提供的object detection API可以很方便的进行fine-tuning实现所需的特定物体检测模型(看这里).那么现在的主要问题就是数 ...

  10. nginx: [emerg] getpwnam(“www”) failed错误

    linux 64系统中安装nginx时如果出现错误:nginx: [emerg] getpwnam(“www”) failed in ........解决方法1:      在nginx.conf中 ...