图片处理软件理

您所在的位置: &
& 图像软件
图片制作软件频道是下载吧为广大用户提供最新最全的图片制作软件下载服务,是图片制作软件下载中心。从这里您不但可以下载到最热门最好用的图片制作软件,还可以下载到一些国内外有特色的图片制作软件。图像图片软件包括以下图像浏览、CAD软件、电子相册、图像管理、图标制作、图片压缩、截图软件、图片转换、图片处理、3D制作软件等。
图片制作软件推荐
图片制作软件大全
大名鼎鼎的AutoCAD2016简体中文版官方发布了!AutoCAD2016是工程制图必备软件,可用于二维绘图、详细绘制、三维设计,具有良好操作界面,可提高制图效率。AutoCAD
大小:1.44 GB
下载:1279次
色彩风暴最小,最快,最方便的图像浏览和分享专家,提供前所未有的图像浏览和分享体验。色彩风暴(Color Storm)是一个文件最小,速度最快,操作最方便,功能强大的图像浏览和分享专家...
大小:14.94 MB
下载:15989次
Rhinoceros官方版是一款超强的三维建模工具。Rhinoceros包含了所有的NURBS建模功能,用它建模
大小:1.05 GB
下载:1459次
CorelCAD2015官方中文版是一款功能强大、经济实惠的CAD软件,行业标准CAD功能、2D绘图和3D设计工具。新的绘图限制功能、就地文本编辑和交互式布
大小:205 MB
下载:1795次
朵拉影像图像处理软件是一款拥有照片美化功能,图像后期调色功能和自动批量模板调色功能的软件。朵拉影像给您专业图像处
大小:82.11 MB
下载:1268次
CorelDRAW Graphics Suite X7是一套非常强大的矢量图设计软件。CorelDRAW X7是一款由世界顶尖软件公司之一的加拿大的 Corel
大小:526 MB
下载:1371次
CorelDRAW X5(Coreldraw Graphics Suite X5)是一款由加拿大渥太华的Corel公司开发的矢量图型编辑与排版软件。CorelD
大小:512 MB
下载:1227次
大头贴制作大师免费版是一款制专业大头贴的制作软件。大头贴制作大师可支持利用各种摄像头、数码摄像机和采集卡等多种视频输入源来连续拍摄制作专业的大头贴图片。如果您没有摄像头也没关系,本软件支持导入各种数码照片(如用数码照相机、手机拍摄的图片,扫描仪扫描的图片、网上下载的图片等等)来制作精美的大头贴图片。软件使用非常方便,只要简单点一下鼠标就可以轻松制作出大头贴照片来,不需要额外任何学习。大头贴制作大师
大小:15.72 MB
下载:2027次
Light Image Resizer(原VSO Image Resizer)是将数码照片和图像存在电脑中,并希望重新调整大小,压缩,转换,创建备份,导入或组织图片的人们设计的完美工具。你是否想过要发送,移动,缩小或 ..
大小:6.3 MB
下载:4057次
图旺旺是一款免费平面广告设计软件,软件内置了海量的设计模板和素材,包括淘宝、名片、相册、通讯录、招牌、菜单、商场海报等等。无需学习任何专业的设计知识也能设计出一流的平面广告。
大小:9.73 MB
下载:1158次
& 上一页 1
4068786次下载
60449次下载
198963次下载
52225次下载
195273次下载
48967次下载
1028526次下载
303768次下载
921924次下载
50557次下载
4068786次下载
2050420次下载
1810313次下载
1723563次下载
1723104次下载
1472450次下载
1028526次下载
921924次下载
899252次下载
686575次下载
热门关键字
微信扫一扫关注下载吧公共帐号让模糊图像变清晰,你也可以! | 科学人 | 果壳网 科技有意思
让模糊图像变清晰,你也可以!
有什么软件能让模糊图变清楚呢?锐化图形的算法
在许多电影和电视剧里,FBI和CIA们轻松敲几下键盘,就可以把一张完全模糊的照片变得非常清晰。可能你也曾经对此嗤之以鼻,觉得这简直就是蒙小孩子的玩意儿,又或者是特殊部门才能拥有的高科技产品。但是现在,你可以用一款平民级软件轻松达成这种效果了。
这款软件的名字叫做SmartDeblur,也就是“智能去模糊”的意思,是由一位研究图像和信号处理的软件工程师弗拉基米尔·宇智科夫(Vladimir Yuzhikov)开发出来的。他说,“不管是从理论上还是从实际应用的角度来看,对失真图像的重建都是图像处理工作中最有趣和最重要的环节之一。”虽然这种重建算法的研究早在70年前就已经开始了,但是直到现在我们才看到结果。
宇智科夫的软件目前能够对两种常见的模糊情况进行处理:由于拍摄时因虚焦产生的模糊和因移动而导致的模糊,他说:“每个人都知道,想要修复它们是很困难的。”此言丝毫不虚,因为在目前阶段,市面上的商用软件都无法达到他的软件所能达到的效果。
以自己在威尼斯拍摄的照片为例,他使用了一个合成模糊滤波器使照片模糊化,然后使用自己的软件对其修复。从上图中可以看到SmartDeblur的确很有效。虽然不能将照片恢复到原始状态,但这样的效果已经很令人震惊了。
很多人认为模糊是一种不可逆的操作,而且信息会相应地永远丢失,因为每个像素都变成了一个斑点,一切都混在了一起,如果遇到了模糊半径比较大的情况,整个图片将会呈现出单一的色彩。但这不完全对,其实所有的信息只是根据一些规则而进行了重新分配,通过一些假设,我们就完全可以重建图像。
当然,只能修复经过人工模糊处理的图像还远远不够。虽然一些现有的去卷积方法也可以对图像进行增强,但是过程及其复杂,耗费时间也很较长,处理一张图片需要几小时甚至几天。Adobe公司以前也演示过一些类似的去模糊方法,但也只能处理在因相机抖动引起的模糊,并且需要利用设备中加速度计里的跟踪数据。
对于我们这些普通用户来说,真正的问题是在现实中拍摄的模糊照片是否能变清晰,而不是对于那些通过人工合成的模糊图像的处理。毕竟,我们在现实中使用任何一台相机,都有可能因为没对上焦或者不必要的运动而产生模糊。因此我们也对SmartDeblur的实拍照片处理能力进行了一番测试。结果证明:SmartDeblur运行的结果虽然不是很完美,但是已经足够惊艳。以下的照片是由佳能500D拍摄。
因虚焦引起的模糊
软件处理结果
因运动引起的模糊
软件处理结果
模糊不清的文字和处理后的图像
虽然经过处理后的图像仍存在不少问题,比如大量的振铃效应和噪点,但是我们确实能够看到SmartDeblur从模糊的图像中获取了更多的细节和信息,而且它对文字的处理效果称得上“化腐朽为神奇”。
宇智科夫说,目前的软件只完成了第一阶段,第二阶段他将会专注于对真实图像的处理,引入更复杂和先进的去卷积技术以及振铃效应消除法等,参考现有的去模糊软件并加以比较。
随着智能手机中图形处理器(GPU)的计算能力日益提高,将这项应用内置于智能手机中也是指日可待,毫无疑问,这对于许多“抽风手”摄影者来说绝对是一大福音。
对SmartDeblur有兴趣的同学可以点击
下载试用。两天前作者刚刚发布了Mac版,现在Windows用户和Mac用户都可以使用这个软件了。
文章编译自:Gizmodo Incredible CSI-Like “Enhance!” App Fixes Your Unfocused Photos
作者:Jesus Diaz
你可能感兴趣
的话:这种软件好!不过运行需要很多时间吗?家用电脑不知道好使不,下载一个看看。顶!这样的回复多好,不说废话,没有无聊的“杀”就不会显得太傻。
勘查技术与工程专业
楼主你好,可以把这张图片变清晰么?≧◇≦
为什么我第一反应是可以有很多猥琐的用途……
显示所有评论
全部评论(228)
这种软件好!不过运行需要很多时间吗?家用电脑不知道好使不,下载一个看看。
的话:这种软件好!不过运行需要很多时间吗?家用电脑不知道好使不,下载一个看看。顶!这样的回复多好,不说废话,没有无聊的“杀”就不会显得太傻。
楼上哈哈哈哈哈
撸管导致的模糊图像怎么破。。
1楼跟2楼重名了
太有意思了
果壳网副主编
哈哈,一楼和二楼太好玩了。嗯,拍照手抖得试试这个。
刚下载体验了,软件很小,操作方便,反应快捷。还有几个参数可调,尚未搞懂。照片的细节部分放大后出现的模糊,没有什么效果。半径选择超过1,就会出现明显的振铃效应,破坏细节。
这种模糊是不是只限于相机照的相?
yy:要是什么图片只要ps里的一个键就变清晰了就无敌了
感觉很不错,试试
不过,我觉得这个软件只能用在警察,考古等地方,正常的你要是拍个照不清,最好当然是从拍吖,你还真会去修下它吖?
的话:撸管导致的模糊图像怎么破。。你看看中医吧,什么淫羊藿什么的,该补就补吧,哈哈
霸气啊!!
同行啊!!
对我很实用,感谢果壳,感谢弗拉德米尔o宇智科夫(俄国人?)
好东西啊,不过感觉一般人用的不多
为什么我第一反应是可以有很多猥琐的用途……
这个软件功能好强大,从画面上看已经达到了顶级的效果了
物理学专业,维基百科小组管理员
话说光影魔术手不就可以防抖了么?
是不是马赛克也能去掉了~~
宇智科夫~和宇智波佐助啥关系~嘛~开玩笑的~(我知道佐助姓宇智波啦~)
勘查技术与工程专业
楼主你好,可以把这张图片变清晰么?≧◇≦
的话:楼主你好,可以把这张图片变清晰么?≧◇≦奇怪的性情向东西慢慢出来了。。。。
果断神器啊,在官网看了一下,我发现了download as tar.gz
尝试了一下能下载,
各位linuxer可以去尝试一下能不能用,
勘查技术与工程专业
的话:奇怪的性情向东西慢慢出来了。。。。我是故意来歪楼的。。。ㄟ( ̄▽ ̄ㄟ)
的话:楼主你好,可以把这张图片变清晰么?≧◇≦要是这种也可以那绿坝娘就失业了!!!!
的话:顶!这样的回复多好,不说废话,没有无聊的“杀”就不会显得太傻。……只能同顶了,话说这简直就是我这种帕金森拍摄者的福音啊有木有
显示所有评论
(C)2013果壳网&京ICP备号-2&京公网安备2015年第一场雪虽然不是很大,但主城区的公园里依然银装素裹,江南四大名园之一的瞻园在白雪世界中更加显得楚楚动人..
去年夏天在泸沽湖拍的片片,暑假的泸沽湖人多的太恐怖了,本来想着到了实地考察个风景好的地方住,结果周一晚上到了,在..
这是前几天拍的,每张图片都做了调色,电影风格一直是我的最爱。大概是我非常喜欢电影的缘故吧。明天又可以出去拍东西..
妥协被指引到很朦胧,原来时光不需要从容。现实的结果怎么背诵,那是我不能触碰的痛。看不到海那边装满信念的橱窗..
分享时间;15-03-23
..
分享达人;
分享时间;15-03-23
..
分享达人;
分享时间;15-03-23
..
分享达人;
分享时间;15-03-23
..
分享达人;
分享时间;15-03-19
日系小清新风格的lightroom预设..
分享达人;
分享时间;15-03-19
(HDR滤镜)汉化破解版Nik software HDR efex pro 2.0
什么是HDR?
HDR:英文全称为High-Dynamic Range,意为“高动态范围”。这是一个简单的术语,HDR照片是使用多 ....
分享达人;
分享时间;15-03-17
新品婚纱调色LR预设50组 Lightroom Presets..
分享达人;
分享时间;15-03-17
唯美清晰Lightroom预设 阴雨天lr预设 精品景色预置
自己用了一下很实用..
分享达人;
分享时间;15-03-17
精品婚礼摄影Lightroom预设16组
商业摄影师lr预设..
分享达人;光影魔术手 简便/易用/功能强大
请关注我们的微博:
光影魔术手 特色功能介绍
Copyright & 浙ICP备号android图片处理方法(不断收集中) - 短裤党 - ITeye技术网站
博客分类:
//压缩图片大小
public static Bitmap compressImage(Bitmap image) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
pressFormat.JPEG, 100, baos);//质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
int options = 100;
while ( baos.toByteArray().length / ) { //循环判断如果压缩后图片是否大于100kb,大于继续压缩
baos.reset();//重置baos即清空baos
pressFormat.JPEG, options, baos);//这里压缩options%,把压缩后的数据存放到baos中
options -= 10;//每次都减少10
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());//把压缩后的数据baos存放到ByteArrayInputStream中
Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);//把ByteArrayInputStream数据生成图片
* 将彩色图转换为灰度图
* @param img 位图
返回转换好的位图
public Bitmap convertGreyImg(Bitmap img) {
int width = img.getWidth();
//获取位图的宽
int height = img.getHeight();
//获取位图的高
int []pixels = new int[width * height]; //通过位图的大小创建像素点数组
img.getPixels(pixels, 0, width, 0, 0, width, height);
int alpha = 0xFF && 24;
for(int i = 0; i & i++)
for(int j = 0; j & j++) {
int grey = pixels[width * i + j];
int red = ((grey
& 0x00FF0000 ) && 16);
int green = ((grey & 0x0000FF00) && 8);
int blue = (grey & 0x000000FF);
grey = (int)((float) red * 0.3 + (float)green * 0.59 + (float)blue * 0.11);
grey = alpha | (grey && 16) | (grey && 8) |
pixels[width * i + j] =
Bitmap result = Bitmap.createBitmap(width, height, Config.RGB_565);
result.setPixels(pixels, 0, width, 0, 0, width, height);
将一个图片切割成多个图片
有种场景,我们想将一个图片切割成多个图片。比如我们在开发一个拼图的游戏,就首先要对图片进行切割。
以下是封装好的两个类,可以实现图片的切割。仅供参考和学习。
一个是ImagePiece类,此类保存了一个Bitmap对象和一个标识图片的顺序索引的int变量。
import android.graphics.B
public class ImagePiece {
public int index = 0;
public Bitmap bitmap =
一个是ImageSplitter类,有一个静态方法split,传入的参数是要切割的Bitmap对象,和横向和竖向的切割片数。比如传入的是3、3,则横竖向都切割成3片,最终会将整个图片切割成3X3=9片。
import java.util.ArrayL
import java.util.L
import android.graphics.B
public class ImageSplitter {
public static List&ImagePiece& split(Bitmap bitmap, int xPiece, int yPiece) {
List&ImagePiece& pieces = new ArrayList&ImagePiece&(xPiece * yPiece);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int pieceWidth = width / 3;
int pieceHeight = height / 3;
for (int i = 0; i & yP i++) {
for (int j = 0; j & xP j++) {
ImagePiece piece = new ImagePiece();
piece.index = j + i * xP
int xValue = j * pieceW
int yValue = i * pieceH
piece.bitmap = Bitmap.createBitmap(bitmap, xValue, yValue,
pieceWidth, pieceHeight);
pieces.add(piece);
1、图标加灰色过滤;
2、android的图片资源默认是静态的,单实例;如果两个IM好友的头像一样,最简单的都是用的软件自带头像,有一个在线,一个离线,直接改变头像的灰度,则两个用户的头像都会变灰或者在线,答案是:Drawable.mutate()。
Drawable mDrawable = context.getResources().getDrawable(R.drawable.face_icon);
//Make this drawable mutable.
//A mutable drawable is guaranteed to not share its state with any other drawable.
mDrawable.mutate();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter cf = new ColorMatrixColorFilter(cm);
mDrawable.setColorFilter(cf);
生成缩略图,抠自android launcher源码:
* Copyright (C) 2008 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
package com.android.
import android.graphics.drawable.BitmapD
import android.graphics.drawable.D
import android.graphics.drawable.PaintD
import android.graphics.B
import android.graphics.PixelF
import android.graphics.C
import android.graphics.PaintFlagsDrawF
import android.graphics.P
import android.graphics.R
import android.content.res.R
import android.content.C
* Various utilities shared amongst the Launcher's classes.
final class Utilities {
private static int sIconWidth = -1;
private static int sIconHeight = -1;
private static final Paint sPaint = new Paint();
private static final Rect sBounds = new Rect();
private static final Rect sOldBounds = new Rect();
private static Canvas sCanvas = new Canvas();
sCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,
Paint.FILTER_BITMAP_FLAG));
* Returns a Drawable representing the thumbnail of the specified Drawable.
* The size of the thumbnail is defined by the dimension
* android.R.dimen.launcher_application_icon_size.
* This method is not thread-safe and should be invoked on the UI thread only.
* @param icon The icon to get a thumbnail of.
* @param context The application's context.
* @return A thumbnail for the specified icon or the icon itself if the
thumbnail could not be created.
static Drawable createIconThumbnail(Drawable icon, Context context) {
if (sIconWidth == -1) {
final Resources resources = context.getResources();
sIconWidth = sIconHeight = (int) resources.getDimension(android.R.dimen.app_icon_size);
int width = sIconW
int height = sIconH
float scale = 1.0f;
if (icon instanceof PaintDrawable) {
PaintDrawable painter = (PaintDrawable)
painter.setIntrinsicWidth(width);
painter.setIntrinsicHeight(height);
} else if (icon instanceof BitmapDrawable) {
// Ensure the bitmap has a density.
BitmapDrawable bitmapDrawable = (BitmapDrawable)
Bitmap bitmap = bitmapDrawable.getBitmap();
if (bitmap.getDensity() == Bitmap.DENSITY_NONE) {
bitmapDrawable.setTargetDensity(context.getResources().getDisplayMetrics());
int iconWidth = icon.getIntrinsicWidth();
int iconHeight = icon.getIntrinsicHeight();
if (width & 0 && height & 0) {
if (width & iconWidth || height & iconHeight || scale != 1.0f) {
final float ratio = (float) iconWidth / iconH
if (iconWidth & iconHeight) {
height = (int) (width / ratio);
} else if (iconHeight & iconWidth) {
width = (int) (height * ratio);
final Bitmap.Config c = icon.getOpacity() != PixelFormat.OPAQUE ?
Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
final Bitmap thumb = Bitmap.createBitmap(sIconWidth, sIconHeight, c);
final Canvas canvas = sC
canvas.setBitmap(thumb);
// Copy the old bounds to restore them later
// If we were to do oldBounds = icon.getBounds(),
// the call to setBounds() that follows would
// change the same instance and we would lose the
// old bounds
sOldBounds.set(icon.getBounds());
final int x = (sIconWidth - width) / 2;
final int y = (sIconHeight - height) / 2;
icon.setBounds(x, y, x + width, y + height);
icon.draw(canvas);
icon.setBounds(sOldBounds);
icon = new FastBitmapDrawable(thumb);
} else if (iconWidth & width && iconHeight & height) {
final Bitmap.Config c = Bitmap.Config.ARGB_8888;
final Bitmap thumb = Bitmap.createBitmap(sIconWidth, sIconHeight, c);
final Canvas canvas = sC
canvas.setBitmap(thumb);
sOldBounds.set(icon.getBounds());
final int x = (width - iconWidth) / 2;
final int y = (height - iconHeight) / 2;
icon.setBounds(x, y, x + iconWidth, y + iconHeight);
icon.draw(canvas);
icon.setBounds(sOldBounds);
icon = new FastBitmapDrawable(thumb);
* Returns a Bitmap representing the thumbnail of the specified Bitmap.
* The size of the thumbnail is defined by the dimension
* android.R.dimen.launcher_application_icon_size.
* This method is not thread-safe and should be invoked on the UI thread only.
* @param bitmap The bitmap to get a thumbnail of.
* @param context The application's context.
* @return A thumbnail for the specified bitmap or the bitmap itself if the
thumbnail could not be created.
static Bitmap createBitmapThumbnail(Bitmap bitmap, Context context) {
if (sIconWidth == -1) {
final Resources resources = context.getResources();
sIconWidth = sIconHeight = (int) resources.getDimension(
android.R.dimen.app_icon_size);
int width = sIconW
int height = sIconH
final int bitmapWidth = bitmap.getWidth();
final int bitmapHeight = bitmap.getHeight();
if (width & 0 && height & 0) {
if (width & bitmapWidth || height & bitmapHeight) {
final float ratio = (float) bitmapWidth / bitmapH
if (bitmapWidth & bitmapHeight) {
height = (int) (width / ratio);
} else if (bitmapHeight & bitmapWidth) {
width = (int) (height * ratio);
final Bitmap.Config c = (width == sIconWidth && height == sIconHeight) ?
bitmap.getConfig() : Bitmap.Config.ARGB_8888;
final Bitmap thumb = Bitmap.createBitmap(sIconWidth, sIconHeight, c);
final Canvas canvas = sC
final Paint paint = sP
canvas.setBitmap(thumb);
paint.setDither(false);
paint.setFilterBitmap(true);
sBounds.set((sIconWidth - width) / 2, (sIconHeight - height) / 2, width, height);
sOldBounds.set(0, 0, bitmapWidth, bitmapHeight);
canvas.drawBitmap(bitmap, sOldBounds, sBounds, paint);
} else if (bitmapWidth & width || bitmapHeight & height) {
final Bitmap.Config c = Bitmap.Config.ARGB_8888;
final Bitmap thumb = Bitmap.createBitmap(sIconWidth, sIconHeight, c);
final Canvas canvas = sC
final Paint paint = sP
canvas.setBitmap(thumb);
paint.setDither(false);
paint.setFilterBitmap(true);
canvas.drawBitmap(bitmap, (sIconWidth - bitmapWidth) / 2,
(sIconHeight - bitmapHeight) / 2, paint);
//Android Matrix类实现镜像方法
public void drawRegion(Image image_src,
int x_src, int y_src,
int width, int height,
int transform,
int x_dest, int y_dest,
int anchor){
if((anchor&VCENTER) != 0){
y_dest -= height/2;
}else if((anchor&BOTTOM) != 0){
if((anchor&RIGHT) != 0){
}else if((anchor&HCENTER) != 0){
x_dest -= width/2;
Bitmap newMap = Bitmap.createBitmap(image_src.getBitmap(), x_src, y_src, width, height);
Matrix mMatrix = new Matrix();
Matrix temp = new Matrix();
Matrix temp2 = new Matrix();
float[] mirrorY = {
temp.setValues(mirrorY);
switch(transform){
case Sprite.TRANS_NONE:
case Sprite.TRANS_ROT90:
mMatrix.setRotate(90,width/2, height/2);
case Sprite.TRANS_ROT180:
mMatrix.setRotate(180,width/2, height/2);
case Sprite.TRANS_ROT270:
mMatrix.setRotate(270,width/2, height/2);
case Sprite.TRANS_MIRROR:
mMatrix.postConcat(temp);
case Sprite.TRANS_MIRROR_ROT90:
mMatrix.postConcat(temp);
mMatrix.setRotate(90,width/2, height/2);
case Sprite.TRANS_MIRROR_ROT180:
mMatrix.postConcat(temp);
mMatrix.setRotate(180,width/2, height/2);
case Sprite.TRANS_MIRROR_ROT270:
mMatrix.postConcat(temp);
mMatrix.setRotate(270,width/2, height/2);
mMatrix.setTranslate(x_dest, y_dest);
canvas.drawBitmap(newMap, mMatrix, mPaint);
//图片Url保存为位图并进行缩放操作
//通过传入图片url获取位图方法
public Bitmap returnBitMap(String url) {
URL myFileUrl =
Bitmap bitmap =
myFileUrl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
HttpURLConnection conn = (HttpURLConnection) myFileUrl
.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
Log.v(tag, bitmap.toString());
//通过传入位图,新的宽.高比进行位图的缩放操作
public static Drawable resizeImage(Bitmap bitmap, int w, int h) {
// load the origial Bitmap
Bitmap BitmapOrg =
int width = BitmapOrg.getWidth();
int height = BitmapOrg.getHeight();
int newWidth =
int newHeight =
Log.v(tag, String.valueOf(width));
Log.v(tag, String.valueOf(height));
Log.v(tag, String.valueOf(newWidth));
Log.v(tag, String.valueOf(newHeight));
// calculate the scale
float scaleWidth = ((float) newWidth) /
float scaleHeight = ((float) newHeight) /
// create a matrix for the manipulation
Matrix matrix = new Matrix();
// resize the Bitmap
matrix.postScale(scaleWidth, scaleHeight);
// if you want to rotate the Bitmap
// matrix.postRotate(45);
// recreate the new Bitmap
Bitmap resizedBitmap = Bitmap.createBitmap(BitmapOrg, 0, 0, width,
height, matrix, true);
// make a Drawable from Bitmap to allow to set the Bitmap
// to the ImageView, ImageButton or what ever
return new BitmapDrawable(resizedBitmap);
1.图片加载方法,方便用户加载图片
* 加载本地图片
* @param context:主运行函数实例
* @param bitAdress:图片地址,一般指向R下的drawable目录
public final Bitmap CreatImage(Context context, int bitAdress) {
Bitmap bitmaptemp =
bitmaptemp = BitmapFactory.decodeResource(context.getResources(),
bitAdress);
2.图片平均分割方法,将大图平均分割为N行N列,方便用户使用
* 图片分割
* @param g
* @param paint
* @param imgBit
* @param x
* :X轴起点坐标
* @param y
* :Y轴起点坐标
* @param w
* :单一图片的宽度
* @param h
* :单一图片的高度
* @param line
* :第几列
* @param row
* :第几行
public final void cuteImage(Canvas g, Paint paint, Bitmap imgBit, int x,
int y, int w, int h, int line, int row) {
g.clipRect(x, y, x + w, h + y);
g.drawBitmap(imgBit, x – line * w, y – row * h, paint);
g.restore();
3.图片缩放,对当前图片进行缩放处理
* 图片的缩放方法
* @param bgimage
* :源图片资源
* @param newWidth
* :缩放后宽度
* @param newHeight
* :缩放后高度
public Bitmap zoomImage(Bitmap bgimage, int newWidth, int newHeight) {
// 获取这个图片的宽和高
int width = bgimage.getWidth();
int height = bgimage.getHeight();
// 创建操作图片用的matrix对象
Matrix matrix = new Matrix();
// 计算缩放率,新尺寸除原始尺寸
float scaleWidth = ((float) newWidth) /
float scaleHeight = ((float) newHeight) /
// 缩放图片动作
matrix.postScale(scaleWidth, scaleHeight);
Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, width, height,
matrix, true);
4.绘制带有边框的文字,一般在游戏中起文字的美化作用
* 绘制带有边框的文字
* @param strMsg
* :绘制内容
* @param g
* @param paint
* @param setx
* ::X轴起始坐标
* @param sety
* :Y轴的起始坐标
* @param fg
* :前景色
* @param bg
* :背景色
public void drawText(String strMsg, Canvas g, Paint paint, int setx,
int sety, int fg, int bg) {
paint.setColor(bg);
g.drawText(strMsg, setx + 1, sety, paint);
g.drawText(strMsg, setx, sety – 1, paint);
g.drawText(strMsg, setx, sety + 1, paint);
g.drawText(strMsg, setx – 1, sety, paint);
paint.setColor(fg);
g.drawText(strMsg, setx, sety, paint);
g.restore();
5.Android 图片透明度处理代码
* 图片透明度处理
* @param sourceImg
* @param number
public static Bitmap setAlpha(Bitmap sourceImg, int number) {
int[] argb = new int[sourceImg.getWidth() * sourceImg.getHeight()];
sourceImg.getPixels(argb, 0, sourceImg.getWidth(), 0, 0,sourceImg.getWidth(), sourceImg.getHeight());// 获得图片的ARGB值
number = number * 255 / 100;
for (int i = 0; i & argb. i++) {
argb = (number && 24) | (argb & 0×00FFFFFF);// 修改最高2位的值
sourceImg = Bitmap.createBitmap(argb, sourceImg.getWidth(), sourceImg.getHeight(), Config.ARGB_8888);
return sourceI
6.图片翻转
Resources res = this.getContext().getResources();
img = BitmapFactory.decodeResource(res, R.drawable.slogo);
Matrix matrix = new Matrix();
matrix.postRotate(90);
/*翻转90度*/
int width = img.getWidth();
int height = img.getHeight();
r_img = Bitmap.createBitmap(img, 0, 0, width, height, matrix, true);
import android.graphics.B
import android.graphics.C
import android.graphics.LinearG
import android.graphics.M
import android.graphics.P
import android.graphics.PixelF
import android.graphics.PorterDuffX
import android.graphics.R
import android.graphics.RectF;
import android.graphics.Bitmap.C
import android.graphics.PorterDuff.M
import android.graphics.Shader.TileM
import android.graphics.drawable.D
* @author superdev
* @version 1.0
public class ImageUtil {
* 放大缩小图片
public static Bitmap zoomBitmap(Bitmap bitmap, int w, int h) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
float scaleWidht = ((float) w / width);
float scaleHeight = ((float) h / height);
matrix.postScale(scaleWidht, scaleHeight);
Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
* 将Drawable转化为Bitmap
public static Bitmap drawableToBitmap(Drawable drawable) {
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
Bitmap bitmap = Bitmap.createBitmap(width, height, drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, width, height);
drawable.draw(canvas);
* 获得圆角图片的方法
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
* 获得带倒影的图片方法
public static Bitmap createReflectionImageWithOrigin(Bitmap bitmap) {
final int reflectionGap = 4;
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
Bitmap reflectionImage = Bitmap.createBitmap(bitmap, 0, height / 2, width, height / 2, matrix, false);
Bitmap bitmapWithReflection = Bitmap.createBitmap(width, (height + height / 2), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmapWithReflection);
canvas.drawBitmap(bitmap, 0, 0, null);
Paint deafalutPaint = new Paint();
canvas.drawRect(0, height, width, height + reflectionGap, deafalutPaint);
canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
Paint paint = new Paint();
LinearGradient shader = new LinearGradient(0, bitmap.getHeight(), 0, bitmapWithReflection.getHeight() + reflectionGap, 0x70ffffff, 0x00ffffff, TileMode.CLAMP);
paint.setShader(shader);
// Set the Transfer mode to be porter duff and destination in
paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
// Draw a rectangle using the paint with our linear gradient
canvas.drawRect(0, height, width, bitmapWithReflection.getHeight() + reflectionGap, paint);
return bitmapWithR
private byte[] Bitmap2Bytes(Bitmap bm){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.pressFormat.PNG, 100, baos);
return baos.toByteArray();
private Bitmap Bytes2Bimap(byte[] b){
if(b.length!=0){
return BitmapFactory.decodeByteArray(b, 0, b.length);
* create the bitmap from a byte array
*生成水印图片
* @param src the bitmap object you want proecss
* @param watermark the water mark above the src
* @return return a bitmap object ,if paramter's length is 0,return null
private Bitmap createBitmap( Bitmap src, Bitmap watermark )
String tag = "createBitmap";
Log.d( tag, "create a new bitmap" );
if( src == null )
int w = src.getWidth();
int h = src.getHeight();
int ww = watermark.getWidth();
int wh = watermark.getHeight();
//create the new blank bitmap
Bitmap newb = Bitmap.createBitmap( w, h, Config.ARGB_8888 );//创建一个新的和SRC长度宽度一样的位图
Canvas cv = new Canvas( newb );
//draw src into
cv.drawBitmap( src, 0, 0, null );//在 0,0坐标开始画入src
//draw watermark into
cv.drawBitmap( watermark, w - ww + 5, h - wh + 5, null );//在src的右下角画入水印
//save all clip
cv.save( Canvas.ALL_SAVE_FLAG );//保存
cv.restore();//存储
/** 重新编码Bitmap
* @param src
需要重新编码的Bitmap
* @param format
编码后的格式(目前只支持png和jpeg这两种格式)
* @param quality
重新生成后的bitmap的质量
返回重新生成后的bitmap
private static Bitmap codec(Bitmap src, pressFormat format,
int quality) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
press(format, quality, os);
byte[] array = os.toByteArray();
return BitmapFactory.decodeByteArray(array, 0, array.length);
//Stream转换成Byte
static byte[] streamToBytes(InputStream is) {
ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
byte[] buffer = new byte[1024];
while ((len = is.read(buffer)) &= 0) {
os.write(buffer, 0, len);
} catch (java.io.IOException e) {
return os.toByteArray();
//把View转换成Bitmap
* 把一个View的对象转换成bitmap
static Bitmap getViewBitmap(View v) {
v.clearFocus();
v.setPressed(false);
//能画缓存就返回false
boolean willNotCache = v.willNotCacheDrawing();
v.setWillNotCacheDrawing(false);
int color = v.getDrawingCacheBackgroundColor();
v.setDrawingCacheBackgroundColor(0);
if (color != 0) {
v.destroyDrawingCache();
v.buildDrawingCache();
Bitmap cacheBitmap = v.getDrawingCache();
if (cacheBitmap == null) {
Log.e(TAG, "failed getViewBitmap(" + v + ")", new RuntimeException());
Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);
// Restore the view
v.destroyDrawingCache();
v.setWillNotCacheDrawing(willNotCache);
v.setDrawingCacheBackgroundColor(color);
读取raw资源文件中的mp3文件,然后通过音乐播放器播放:
* 把mp3文件写入卡
* @param fileName
输出的文件名(全路径)
* @param context
context对象
private void writeMP3ToSDcard(String fileName, Context context) {
byte[] buffer = new byte[1024 * 8];
BufferedInputStream bin = new BufferedInputStream(context.getResources().openRawResource(R.raw.ring));
BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(fileName));
while ((read = bin.read(buffer)) & -1) {
bout.write(buffer, 0, read);
bout.flush();
bout.close();
bin.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(newFile("XXXXmp3的文件全路径")),"audio/*");
startActivity(intent);
绘制图像倒影
private void
m_paint = new Paint(Paint.ANTI_ALIAS_FLAG);
LinearGradient lg = new LinearGradient(
0, 0, 0, m_nShadowH,
0xB0FFFFFF, 0x,
Shader.TileMode.CLAMP);
m_paint.setShader(lg);
m_paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
@Override protected void
onDraw(Canvas canvas)
super.onDraw(canvas);
int nX = 0;
int nY = 20;
_DrawNormalImg(canvas, nX, nY);
_DrawMirror(canvas, nX, nY);
private void
_DrawNormalImg(Canvas canvas, int nX, int nY)
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.translate(nX, nY);
m_dw.draw(canvas);
canvas.restore();
private void
_DrawMirror(Canvas canvas, int nX, int nY)
int nW = m_dw.getIntrinsicWidth();
int nH = m_dw.getIntrinsicHeight();
///////////////////////////////////
//draw mirror image
canvas.save(Canvas.MATRIX_SAVE_FLAG);
canvas.scale(1.0f, -1.0f);
canvas.translate(nX, -(nY + nH * 2));
canvas.clipRect(0, nH, nW, nH - m_nShadowH);
m_dw.draw(canvas);
canvas.restore();
//////////////////////////////
//draw mask
canvas.save();
canvas.translate(nX, nY + nH);
canvas.drawRect(0, 0, nW, m_nShadowH, m_paint);
canvas.restore();
Android 繪圖座標體系預設的原點在左上角,X 軸往右是越來越大的正值,而 Y 軸往下,則是越來越大的正值。要畫出垂直翻轉的圖片,其實也就是要垂直翻轉整個繪圖座標體系。在 Android 中,要如何做?答案就是 canvas.scale(1.0f, -1.0f)。很簡單吧,沒想到給 scale() 函式一個負值,就可以翻轉相對應的軸。
在 Photoshop 中,做鏡像特效的第二步是要對這翻轉的圖片,加個由灰到黑的漸層 mask。
在 Android 中,要畫漸層色,那就一定得用 LinearGradient 這個類別。至於要對背景圖加上個 mask,就請參考一下 Paint 的 setXfermode() 函式。_Init() 這個函式,就是負責生成一個由灰到黑漸層 mask 的 m_paint 物件。
android常用图片特效处理
相机(Camera)实时滤镜效果
Android, WindowsPhone7, IOS ,vc2010平台40多套图片滤镜开源
Android实现获取本机中所有图片
(820.1 KB)
下载次数: 531
浏览 47570
gundumw100
浏览: 2205892 次
来自: 上海
很赞,楼主,现在这个开源的,升级过快。没有android st ...
不错,不需要知道启动类就可以启动另外一个apk
且不切回去了
你好,我这个方法不能用啊,怎么办?DocumentsContr ...
demo看了不知道这个控件是做什么用的,也没有看出有什么好。

我要回帖

更多关于 相片处理 的文章

 

随机推荐