加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

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

发布时间:2020-12-14 06:30:59 所属栏目:Java 来源:网络整理
导读:在上一个版本:java画图程序_图片用字母画出来_源码发布 ?基础上,增加了图片同比例缩放,使得大像素图片可以很好地显示画在Notepad++中。 原图:http://images.cnblogs.com/cnblogs_com/hongten/356471/o_imagehandler_result1.png 原图:http://images.cnb

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

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

原图: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 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); } painting(String originalImagePath,String scalImagepath, [][] result = 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 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 = } 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] = } BufferedImage readImage(File file) BufferedImage bufImg = height = width = StringBuffer getCanvas( StringBuffer stringBuffer = ( y = 0; y < height; y++ ( x = 0; x < width; x++ StringBuffer(stringBuffer.substring(0,stringBuffer.length() - 1 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 } 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 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 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), } inputFilePath.substring(inputFilePath.lastIndexOf(Common.FULL_STOP) + 1 ImageIcon getImage(Image img, ImageIcon icon = 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() * } Image getScaledImage(Image srcImg, width, BufferedImage resizedImg = Graphics2D g2 = g2.drawImage(srcImg, Image image = srcImg.getScaledInstance(srcImg.getWidth(),srcImg.getHeight( getScaling( sourceWidth, sourceHeight, widthScaling = (() snapWidthMax * () scaled) / ( heightScaling = (() snapHeightMax * () scaled) / ( scaling = (widthScaling < heightScaling) ? }

File f = BufferedWriter output = output = BufferedWriter( } }

源码下载: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 |?

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读