pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/Ruffianjiang/java4fun/tree/master/img2text

assets/primer-70be7debc79a8eff.css" /> java4fun/img2text at master · Ruffianjiang/java4fun · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

目录

  1. 图片转图片
    参数调整
  2. gif转gif
  3. 视频转视频

图片转图片

ImgUtil.java

原图

转换后

    @Test
    public static void imgTest() {
        String inputFile = "F:/123/head.png";
        String outputFile = "F:/123/head_copy.png";
        // String base = "01"; // 替换的字符串
        String base = "@#&$%*o!;.";// 字符串由复杂到简单
        int threshold = 8;// 阈值
        ImgUtil.toTextImg(inputFile, outputFile, base, threshold);
    }

具体参数调整如下图所示:

参数调整

  1. 调整字符大小,颜色
  2. 调整字符间距
  3. 调整字符的区域 (index数值越小,灰度越大)

gif转gif

GifUtil.java

原图

转换后1

原图

转换后1

转换后2

测试代码

    @Test
    public static void gifTest() {
        String srcFile = "F:/123/123.gif";
        String targetFile = "F:/123/123_04.gif";
        String base = "01"; // 替换的字符串
        // String base = "@#&$%*o!;.";// 字符串由复杂到简单
        int threshold = 3;// 阈值
        GifUtil.toTextGif(srcFile, targetFile, base, threshold);
    }

视频转视频

FfmpegUtil.java\VideoUtil.java

没做细致的调整,视频的转换可以调调参数

Watch the video

Watch the video

测试代码

    @Test
    public static void videoTest() {
        String srcVideoPath = "F:/123/123.mp4";
        String tarImagePath = "F:/123/mp/";
        String tarAudioPath = "F:/123/mp/audio.aac";
        String tarVideoPath = "F:/123/1234.mp4";
        VideoUtil.readVideo(srcVideoPath,tarImagePath,tarAudioPath,tarVideoPath);
    }
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy