imageView2 = (ImageView) findViewById(R.id.img2); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); //创建一个与bitmap一样大小的bitmap2 Bitmap bitmap2 = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getCo…
Android图片处理(Matrix,ColorMatrix) 转载自:http://www.cnblogs.com/leon19870907/articles/1978065.html 在编程中有时候需要对图片做特殊的处理,比如将图片做出黑白的,或者老照片的效果,有时候还要对图片进行变换,以拉伸,扭曲等等. 这些效果在android中有很好的支持,通过颜色矩阵(ColorMatrix)和坐标变换矩阵(Matrix)可以完美的做出上面的所说的效果. 下面将分别介绍这两个矩阵的用法和相关的函数.…
MainActivity如下: import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ImageView; import android.app.Activity; import android.graphics.Matrix; /** * Demo描述:…
MainActivity例如以下: import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ImageView; import android.app.Activity; import android.graphics.Matrix; /** * Demo描…
android 图片压缩方法: 第一:质量压缩法: private Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ByteArrayOutputStream();        image.compress(Bitmap.CompressFormat.JPEG, 100, baos);//质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中        int options = 100…
转发说明:原文链接http://www.cnblogs.com/leon19870907/articles/1978065.html 在编程中有时候需要对图片做特殊的处理,比如将图片做出黑白的,或者老照片的效果,有时候还要对图片进行变换,以拉伸,扭曲等等. 这些效果在android中有很好的支持,通过颜色矩阵(ColorMatrix)和坐标变换矩阵(Matrix)可以完美的做出上面的所说的效果. 下面将分别介绍这两个矩阵的用法和相关的函数. 颜色矩阵android中可以通过颜色矩阵(ColorM…
本文转载于:http://www.cnblogs.com/leon19870907/articles/1978065.html 在编程中有时候需要对图片做特殊的处理,比如将图片做出黑白的,或者老照片的效果,有时候还要对图片进行变换,以拉伸,扭曲等等. 这些效果在android中有很好的支持,通过颜色矩阵(ColorMatrix)和坐标变换矩阵(Matrix)可以完美的做出上面的所说的效果. 下面将分别介绍这两个矩阵的用法和相关的函数. 颜色矩阵 android中可以通过颜色矩阵(ColorMat…
图片的变化主要是matrix的变化,对matrix不懂的可以先了解下matrxi. public class FunnyView extends View { /* * 手指按下时可能是移动 也可能是拖动 */ private static final int ZOOM = -1 ; private static final int DRAG = 1; private int mode = 0; // 第一个触控点 private PointF startPointF = new PointF…
第一种方案 使用 QPixmap 的 transformed 函数来实现旋转,这个函数默认是以图片中心为旋转点,不能设置旋转的中心点,使用如下: QMatrix matrix; matrix.rotate(45); QLabel *Label= new QLabel(); Label->setPixmap(QPixmap(":/images.png").transformed(matrix, Qt::SmoothTransformation)); 该段程序实现的效果是使图片顺时针…
拍照后的照片有时被系统旋转,纠正步骤如下: 1.先读取图片文件被旋转的角度: /** * 通过ExifInterface类读取图片文件的被旋转角度 * @param path : 图片文件的路径 * @return 图片文件的被旋转角度 */ public static int readPicDegree(String path) { ; // 读取图片文件信息的类ExifInterface ExifInterface exif = null; try { exif = new ExifInte…