2012-02-17 119 views
8

我正在研究小型android应用程序,并且我想对图像,即素描,单色,棕褐色,木炭,油画,否定,翻转,翻牌,浮雕等效果在图像上做一个效果,色调,饱和度,亮度,对比度,图像清晰度。 有没有这样的工具的任何Android库。 我真的很感激任何帮助。Android图像处理库

+0

见我的答案在这里:HTTP:/ /stackoverflow.com/questions/10662123/photo-editing-on-phonegap-android/10662148#10662148 – 2012-05-19 14:26:40

+0

有什么最好的解决方案? – UserDev 2014-05-21 06:22:06

回答

4

试试这个库

JJIL

+0

JJIL包含了大量的类,我很困惑,我不知道如何使用它?你能否给我推荐一些使用图像处理JJIL库的教程。请帮忙。 – Raj21 2012-02-22 09:14:22

+0

JJIL包含了大量的类,我很困惑,我不明白如何使用它?你能否给我推荐一些使用图像处理JJIL库的教程。请尽快回复.. – Raj21 2012-02-24 09:51:11

+1

尝试阅读本文档:http://code.google.com/p/jjil/wiki/IntroductionToJJIL?tm = 6 – Vikram 2012-02-24 09:56:27

0

基本图像效果可以通过非标准Android的工具来实现。考虑android.graphics包(它们与本地图像格式和位图工作)

+0

我是新来的android请建议我一些教程,在Android中使用基本的图像效果。 thanx提前。 – Raj21 2012-02-22 09:16:55

+0

首先阅读官方的Android教程和文档 – 2012-02-22 09:46:30

+0

好吧,哥们,谢谢我试试.. – Raj21 2012-02-22 12:20:52

1

使用下面的代码来对比增加了位:值的范围从1到100

public static Bitmap AdjustContrast(Bitmap original, float Value){ 
     Value          = (100.0f + Value)/100.0f; 
     Value *= Value; 
     Bitmap newBitmap       = Bitmap.createBitmap(original.getWidth(), original.getHeight(),original.getConfig()); 
     int[] argb         = new int[original.getWidth() * original.getHeight()]; 
     original.getPixels(argb, 0, original.getWidth(), 0, 0, original.getWidth(), original.getHeight()); 
     for (int i = argb.length - 1; i >= 0; --i) { 
     int alpha         = argb[i] >> 24; 
     int red          = (argb[i] >> 16) & 0xFF; 
     int green         = (argb[i] >> 8) & 0xFF; 
     int blue         = argb[i] & 0xFF;   
     float Red         = red/255.0f; 
     float Green         = green/255.0f; 
     float Blue         = blue/255.0f; 
     Red           = (((Red - 0.5f) * Value) + 0.5f) * 255.0f; 
     Green          = (((Green - 0.5f) * Value) + 0.5f) * 255.0f; 
     Blue          = (((Blue - 0.5f) * Value) + 0.5f) * 255.0f; 
     int iR          = (int)Red; 
     iR           = iR > 255 ? 255 : iR; 
     iR           = iR < 0 ? 0 : iR; 
     int iG          = (int)Green; 
     iG           = iG > 255 ? 255 : iG; 
     iG           = iG < 0 ? 0 : iG; 
     int iB          = (int)Blue; 
     iB           = iB > 255 ? 255 : iB; 
     iB           = iB < 0 ? 0 : iB;     
     int composite        = (alpha << 24) | (iR << 16) | (iG << 8) | iB; 
     argb[i]          = composite; 
     } 
     newBitmap.setPixels(argb, 0, original.getWidth(), 0, 0, original.getWidth(), original.getHeight()); 
     Store.lastBitmap       = newBitmap; 
     return newBitmap; 
    } 

使用此亮度效果:值应介于1到100之间

public static Bitmap makeBrightnessBitmap(Bitmap original, int brightness){ 
     Bitmap newBitmap       = Bitmap.createBitmap(original.getWidth(), original.getHeight(),original.getConfig()); 
     int[] argb         = new int[original.getWidth() * original.getHeight()]; 
     original.getPixels(argb, 0, original.getWidth(), 0, 0, original.getWidth(), original.getHeight()); 
     for (int i = argb.length - 1; i >= 0; --i) { 
      int alpha        = argb[i] >> 24; 
      int red         = (argb[i] >> 16) & 0xFF; 
      int green        = (argb[i] >> 8) & 0xFF; 
      int blue        = argb[i] & 0xFF;      
      int red2        = red + brightness; 
      if (red2>0xFF) red2      = 0xFF; 
      if (red2<0) red2      = 0; 
      int green2        = green + brightness; 
      if (green2>0xFF) green2     = 0xFF; 
      if (green2<0) green2     = 0; 
      int blue2        = blue + brightness; 
      if (blue2>0xFF) blue2     = 0xFF; 
      if (blue2<0) blue2      = 0;     
      int composite       = (alpha << 24) | (red2 << 16) | (green2 << 8) | blue2; 
      argb[i]         = composite; 
     } 
     newBitmap.setPixels(argb, 0, original.getWidth(), 0, 0, original.getWidth(), original.getHeight()); 
     Store.lastBitmap       = newBitmap; 
     return newBitmap; 
    } 
+0

发现这真的很有帮助。非常感谢。效果也非常快速应用 – Amanni 2014-02-21 15:02:44

+0

这里的商店是什么? – Kedarnath 2014-05-20 08:21:03

+0

商店可能是一个用于存储临时数据的类,并且具有一个公共变量“lastBitmap”。 – raisahab 2017-02-22 07:17:44