/**

* 获取 Jpg图片的像素数

* @param is

* @return

*/

private static long getJpgPixes(InputStream is)

{

int w = 0;

int h = 0;

int b = 0;

try

{

while ( (b = is.read()) != -1)

{

if (b == 0xff)

{

b = is.read();

if (b >= 0xc0 && b <= 0xc3)

{

is.skip(3);//跳过3字节

h = (is.read() << 8) | (is.read());

w = (is.read() << 8) | (is.read());

return w * h;

}

else if (b != 0 && b != 0xd9 && b !=0xd8)

{

int length = (is.read() << 8) | (is.read());

is.skip(length - 2);

}

else if (b == -1)

{

break;

}

}

}

return -1;

}

catch (Exception e)

{

e.printStackTrace();

}

return -1;

}