|
@@ -8,6 +8,8 @@ import java.awt.RenderingHints;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
@@ -217,6 +219,24 @@ public class ImageUtil {
|
|
|
return strList;
|
|
|
}
|
|
|
|
|
|
+ public static void printAllImg(File file) throws Exception {
|
|
|
+ if (file.isFile()) {
|
|
|
+ InputStream is = new FileInputStream(file);
|
|
|
+ BufferedImage bi = ImageIO.read(is);
|
|
|
+ is.close();
|
|
|
+ List<String> strList = toStringList(bi);
|
|
|
+ System.out.println(file.getPath());
|
|
|
+ for (String str : strList) {
|
|
|
+ System.out.println(str);
|
|
|
+ }
|
|
|
+ } else if (file.isDirectory()) {
|
|
|
+ File[] files = file.listFiles();
|
|
|
+ for (File fileInner : files) {
|
|
|
+ printAllImg(fileInner);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
boolean isTextBlack = true;
|
|
|
{
|
|
@@ -238,13 +258,6 @@ public class ImageUtil {
|
|
|
System.out.println(str);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- {
|
|
|
- OutputStream os = new FileOutputStream("cow.bmp");
|
|
|
- drawChinese("牛逼", false, 64, isTextBlack, os);
|
|
|
- os.close();
|
|
|
- }
|
|
|
-
|
|
|
{
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
|
drawLaugh(72, isTextBlack, os);
|
|
@@ -258,12 +271,6 @@ public class ImageUtil {
|
|
|
}
|
|
|
}
|
|
|
{
|
|
|
- OutputStream os = new FileOutputStream("Laugh.bmp");
|
|
|
- drawLaugh(72, isTextBlack, os);
|
|
|
- os.close();
|
|
|
- }
|
|
|
-
|
|
|
- {
|
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
|
drawCry(72, isTextBlack, os);
|
|
|
os.close();
|
|
@@ -275,10 +282,58 @@ public class ImageUtil {
|
|
|
System.out.println(str);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
{
|
|
|
- OutputStream os = new FileOutputStream("Cry.bmp");
|
|
|
- drawCry(72, isTextBlack, os);
|
|
|
+ OutputStream os = new FileOutputStream("Cow1.bmp");
|
|
|
+ drawChinese("牛逼", false, 64, false, os);
|
|
|
+ os.close();
|
|
|
+ }
|
|
|
+ {
|
|
|
+ OutputStream os = new FileOutputStream("Cow2.bmp");
|
|
|
+ drawChinese("牛逼", false, 64, true, os);
|
|
|
+ os.close();
|
|
|
+ }
|
|
|
+ {
|
|
|
+ OutputStream os = new FileOutputStream("Laugh1.bmp");
|
|
|
+ drawLaugh(72, false, os);
|
|
|
+ os.close();
|
|
|
+ }
|
|
|
+ {
|
|
|
+ OutputStream os = new FileOutputStream("Laugh2.bmp");
|
|
|
+ drawLaugh(72, true, os);
|
|
|
+ os.close();
|
|
|
+ }
|
|
|
+ {
|
|
|
+ OutputStream os = new FileOutputStream("Cry1.bmp");
|
|
|
+ drawCry(72, false, os);
|
|
|
+ os.close();
|
|
|
+ }
|
|
|
+ {
|
|
|
+ OutputStream os = new FileOutputStream("Cry2.bmp");
|
|
|
+ drawCry(72, true, os);
|
|
|
os.close();
|
|
|
}
|
|
|
+
|
|
|
+ {
|
|
|
+ printAllImg(new File("img"));
|
|
|
+ }
|
|
|
+ // {
|
|
|
+ // InputStream is = Constant.getStream("img" + Constant.getSeperator() + "img1.jpg");
|
|
|
+ // BufferedImage bi = ImageIO.read(is);
|
|
|
+ // is.close();
|
|
|
+ // List<String> strList = toStringList(bi);
|
|
|
+ // for (String str : strList) {
|
|
|
+ // System.out.println(str);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // {
|
|
|
+ // InputStream is = Constant.getStream("img" + Constant.getSeperator() + "img2.jpg");
|
|
|
+ // BufferedImage bi = ImageIO.read(is);
|
|
|
+ // is.close();
|
|
|
+ // List<String> strList = toStringList(bi);
|
|
|
+ // for (String str : strList) {
|
|
|
+ // System.out.println(str);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
}
|