|
@@ -164,6 +164,11 @@ public class ImageUtil {
|
|
|
}
|
|
|
|
|
|
public static List<String> toStringList(BufferedImage bi) {
|
|
|
+ List<String> result = toStringList(bi, false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static List<String> toStringList(BufferedImage bi, boolean reverse) {
|
|
|
List<String> result = new ArrayList<String>();
|
|
|
int width = bi.getWidth();
|
|
|
int height = bi.getHeight();
|
|
@@ -191,17 +196,11 @@ public class ImageUtil {
|
|
|
totalValue += value;
|
|
|
}
|
|
|
int charIndex = (int) (1.0 * totalValue / total_rgb * base.length());
|
|
|
+ if (reverse) {
|
|
|
+ charIndex = base.length() - 1 - charIndex;
|
|
|
+ }
|
|
|
char ch = base.charAt(charIndex);
|
|
|
sb.append(ch);
|
|
|
- // String str;
|
|
|
- // if (totalValue < 256) {
|
|
|
- // str = "█";
|
|
|
- // } else if (totalValue < 768) {
|
|
|
- // str = "▓";
|
|
|
- // } else {
|
|
|
- // str = " ";
|
|
|
- // }
|
|
|
- // sb.append(str);
|
|
|
}
|
|
|
result.add(sb.toString());
|
|
|
}
|