Atitit.识别损坏的图像

Atitit.识别损坏的图像

 

判断jpg图像损坏原理。读取gray line perc ent

Png图片送货原理,直接回报EOFException

 

/atiplat_cms/src/com/attilax/img/imgx.java

int brk_pct = new imgx().GrayLinePercent(f);

 

作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 

汉字名:艾提拉(艾龙)   EMAIL:1466519819@qq.com

转载请注明来源: http://blog.csdn.net/attilax

 

 

/**

attilax    2016年9月28日  下午5:35:57

 * @param f

 * @return

 */

public int GrayLinePercent(String f) {

BufferedImage img = null;

try {

img = ImageIO.read(new File( f));

} catch(EOFException e)

{

throw new PngFormatEx(f);

}catch (IOException e) {

ExUtil.throwEx(e);

}

return ( GrayLinePercent(img) );

 

}

 

/**

 *

attilax    2016年9月28日  下午5:18:58

 * @param image

 * @return

 */

public static int GrayLinePercent(BufferedImage image) {

 int heit=image.getHeight();

 int gray=0;

 for(int i=0;i<heit;i++)

 {

 if(i==185)

 System.out.println("dbg");

 PixLine pl=getPixLine(image, i);

 if(isGrayLinee(pl))

 gray++;

 }

return (int) ((float)gray/(float)heit*100);

}

 

 

atiend

posted @ 2016-10-04 03:06  attilaxAti  阅读(26)  评论(0编辑  收藏  举报