微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java画图程序_图片用字母画出来_源码发布_版本二

在上一个版本:java画图程序_图片用字母画出来_源码发布 基础上,增加图片同比例缩放,使得大像素图片可以很好地显示画在Notepad++中。

效果1:

原图:http://images.cnblogs.com/cnblogs_com/hongten/356471/o_imagehandler_result1.png

效果2:

原图:http://images.cnblogs.com/cnblogs_com/hongten/356471/o_imagehandler_result2.png

Including TWO functions : Color image to converted black and white picture. Imitating the original image to paint into the TXT file with alphabets. String SCALED_IMAGE = Common.SCALED + Common.FULL_STOP + painting(Common.ORIGINAL,SCALED_IMAGE,1 aram File file = File[] fileList = ( i = 0; i < fileList.length; i++ String originalImagePath = System.out.println("Processing ... " + SCALED_IMAGE = Common.SCALED + Common.FULL_STOP + painting(originalImagePath,1 Thread.sleep(4000); } printstacktrace(); painting(String originalImagePath,String scalImagepath, [][] result =timageGRB(scalImagepath); StringBuffer stringBuffer = File input = File out = }

String PATH = "src/com/b510/image/resources/" String ORIGINAL = PATH + "original.jpg" String SCALED = PATH + "scaled" String ORIGINAL_IMAGE = PATH + "original_image.png" String PROCESSED_IMAGE = PATH + "processed_image.png" String OUTPUT_TXT = PATH + "output.txt" String PROCESSED_SUCCESS = "Processed successfully..." String PROCESS_ERROR = "Processing encounters error!" String R = "R" String A = "A" String X = "X" String M = "M" String W = "W" String H = "H" String E = "E" String J = "J" String L = "L" String C = "C" String V = "V" String Z = "Z" String Q = "Q" String T = "T" String r = "r" String s = "s" String w = "w" String u = "u" String l = "l" String i = "i" String e = "e" String m = "m" String a = "a" String COMMA = "," String FULL_STOP = "." String BLANK = " " String NEW_LINE = "\n" }

height = 0 width = 0 aram aram Image image = srcH = image.getHeight( srcW = image.getWidth( BufferedImage bufferedImage = bufferedImage.getGraphics().drawImage(image,srcW, bufferedImage = ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY),).filter(bufferedImage, FileOutputStream fos = JPEGImageEncoder encoder = stem.out.println(Common.PROCESSED_SUCCESS); } galStateException(Common.PROCESS_ERROR,e); aram timageGRB(String filePath) { File file = [][] result = (! BufferedImage bufImg = result = ( y = 0; y < height; y++ ( x = 0; x < width; x++ temp = Double.valueOf(bufImg.getRGB(x,y) & 0xFFFFFF result[y][x] = } printstacktrace(); aram BufferedImage readImage(File file) BufferedImage bufImg = height = width = aram StringBuffer getCanvas( StringBuffer stringBuffer = ( y = 0; y < height; y++ ( x = 0; x < width; x++ StringBuffer(stringBuffer.substring(0,stringBuffer.length() - 1 aram aram aram aram fullBlank([][] result,StringBuffer stringBuffer, y, (result[y][x] > 0.0 && result[y][x] < 168.0 } (result[y][x] >= 168.0 && result[y][x] < 212.0 } aram aram aram aram fullBlackColor([][] result, (result[y][x] > 0.0 && result[y][x] < 25.0 } (result[y][x] >= 25.0 && result[y][x] < 50.0 } (result[y][x] >= 50.0 && result[y][x] < 75.0 } (result[y][x] >= 75.0 && result[y][x] < 100.0 } (result[y][x] >= 100.0 && result[y][x] < 125.0 } (result[y][x] >= 125.0 && result[y][x] < 150.0 } (result[y][x] >= 150.0 && result[y][x] < 154.0 } (result[y][x] >= 154.0 && result[y][x] < 158.0 } (result[y][x] >= 158.0 && result[y][x] < 162.0 } (result[y][x] >= 162.0 && result[y][x] < 168.0 aram aram aram aram fullGreyColor([][] result, (result[y][x] >= 168.0 && result[y][x] < 172.0 } (result[y][x] >= 172.0 && result[y][x] < 176.0 } (result[y][x] >= 176.0 && result[y][x] < 180.0 } (result[y][x] >= 180.0 && result[y][x] < 184.0 } (result[y][x] >= 184.0 && result[y][x] < 188.0 } (result[y][x] >= 188.0 && result[y][x] < 192.0 } (result[y][x] >= 192.0 && result[y][x] < 196.0 } (result[y][x] >= 196.0 && result[y][x] < 200.0 } (result[y][x] >= 200.0 && result[y][x] < 204.0 } (result[y][x] >= 204.0 && result[y][x] < 208.0 } (result[y][x] >= 208.0 && result[y][x] < 212.0 aram aram aram aram fullWhiteColor([][] result, (result[y][x] >= 212.0 && result[y][x] < 216.0 } (result[y][x] >= 216.0 && result[y][x] < 220.0 } (result[y][x] >= 220.0 && result[y][x] < 224.0 } (result[y][x] >= 224.0 && result[y][x] < 228.0 } (result[y][x] >= 228.0 && result[y][x] < 232.0 } (result[y][x] >= 232.0 && result[y][x] < 236.0 } (result[y][x] >= 236.0 && result[y][x] < 240.0 } (result[y][x] >= 240.0 && result[y][x] < 244.0 } (result[y][x] >= 244.0 && result[y][x] < 248.0 } (result[y][x] >= 248.0 && result[y][x] < 252.0 } (result[y][x] >= 252.0 && result[y][x] < 257.0 }

snapHeightMax = 196 snapWidthMax = 200 scaledImage(String originalImagePath, ImageIcon icon = getimage(ImageIO.read( File(originalImagePath)),5 BufferedImage savedImage = savedImage.createGraphics().drawImage(icon.getimage(), ImageIO.write(savedImage,getPostfix(originalImagePath), stem.out.println(Common.PROCESSED_SUCCESS); } printstacktrace(); inputFilePath.substring(inputFilePath.lastIndexOf(Common.FULL_STOP) + 1 ImageIcon getimage(Image img, ImageIcon icon = timages(img,scaled)); Image getimages(Image img, heigth = 0 width = 0 (scaled < 25 scaled = 25 String sScaled = String.valueOf(Math.ceil(() scaled / 25 indexX = sScaled.indexOf("." scaled = Integer.parseInt(sScaled.substring(0 scaleds = getScaling(img.getWidth(),img.getHeight( heigth = () (img.getHeight() * width = () (img.getWidth() * } printstacktrace(); Image getScaledImage(Image srcImg, width, BufferedImage resizedImg = Graphics2D g2 = g2.drawImage(srcImg, dispose(); Image image = srcImg.getScaledInstance(srcImg.getWidth(),srcImg.getHeight( aram aram getScaling( sourceWidth, sourceHeight, widthScaling = (() snapWidthMax * () scaled) / ( heightScaling = (() snapHeightMax * () scaled) / ( scaling = (widthScaling < heightScaling) ? }

aram File f = BufferedWriter output = output = BufferedWriter( } printstacktrace(); }

源码下载:http://files.cnblogs.com/hongten/imageHandler_v1.2.rar

========================================================

More reading,and english is important.

I'm Hongten

大哥哥大姐姐,觉得有用打赏点哦!多多少少没关系,一分也是对我的支持和鼓励。谢谢。Hongten博客排名在100名以内。粉丝过千。Hongten出品,必是精品。

E | hongtenzone@foxmail.com  B | 

========================================================

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐