JBuilder设计获取图片属性程序 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-23
&(byte1[2] == 70)&&(byte1[3] == 56)&&((byte1[4] == 55)||(byte1[4] == 57))&&(byte1[5] == 97))
{
strFileExtendName = "GIF";
}
//header bytes contains JFIF?
if ((byte1[6] == 74)&&(byte1[7] == 70)&&(byte1[8] == 73)&&(byte1[9] == 70))
{
strFileExtendName = "JPG";
}
//header bytes contains BM?
if ((byte1[0] == 66)&&(byte1[1] == 77))
{
strFileExtendName = "BMP";
}
//header bytes contains PNG?
if ((byte1[1] == 80)&&(byte1[2] == 78)&&(byte1[3] == 71))
{
strFileExtendName = "PNG";
}
return strFileExtendName;
}
private static int getFileAttribute(byte[] byte2,int n,int m,String fileextendname)
{
int j,FileAttributeValue;
j = 0;
FileAttributeValue = 0;
String str,str1;
str = "";
str1 = "";
//泌惚凪寄噐127?夸郡岻竃?富噐0?俶勣序佩?256塰麻
for (int k = 0; k < m; k ++)
{
if (byte2[n-k] < 0)
{
j = byte2[n-k];
j = j + 256;
}
else
{
j = byte2[n-k];
}
str1 = Integer.toHexString(j);
//廬晒葎16序崙?音怎了温0
if (str1.length() < 2)
{
str1 = "0" + str1;
}
//鯉塀議音揖?燕器奉來議忖准匆嗤延晒
if(fileextendname.equalsIgnoreCase("JPG")||fileextendname.equalsIgnoreCase("PNG"))
{
str = str1 + str;
}
else
{
str = str + str1;
}
}
FileAttributeValue = HexToDec(str);
return FileAttributeValue;
}
private static int HexToDec(String cadhex)
{
int n, i, j,k,decimal;
String CADHEX1;
n = 0;
i = 0;
j = 0;
k = 0;
decimal = 0;
CADHEX1 = null;
n =cadhex.length();
CADHEX1 = cadhex.trim().toUpperCase();
while(i < n)
{
j = CADHEX1.charAt(i);
if ((j >= 48) && (j < 65))
{
j = j - 48;
}
if (j >= 65)
{
j = j - 55;
}
i = i + 1;
//16竹塰麻
k = 1;
for (int m = 0; m < (n-i); m ++)
{
k = 16 * k;
}
decimal = j*k + decimal;
}
return decimal;
}
private static String getPicColor(int color)
{
int k;
k = 1;
String piccolor;
piccolor = null;
//2竹塰麻
for (int m = 0; m < color; m ++)
{
k = 2 * k;
}
Integer kk;
kk = null;
if (k >= 1048576)
{
k = k / 1048576;
kk = new Integer(k);
piccolor = kk.toString() + "M";
}
else if (k >= 1024)
{
k = k / 1024;
kk = new Integer(k);
piccolor = kk.toString() + "K";
}
else if (k > 0)
{
kk = new Integer(k);
piccolor = kk.toString();
}
return piccolor;
}
}
膨、朔芝 參貧坿旗鷹壓Win 2k才Jbuilder 7吉桟廠和屎械塰佩狛。喇噐扮寂購狼?乎殻會朕念峪屶隔GIF(嗤87A/8 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于JBuilder设计获取图片属性程序 - 编程入门网的所有评论