drawtext

canvas drawtext with multiline

大憨熊 提交于 2021-02-19 02:19:32
问题 I am developing a image commenting application. I draw text in canvas with canvas.drawText(text, x, y, imgPaint); This appears in a single line. I need to break the line to multiline when the text crosses the canvas width Thanks in advance 回答1: You need to use StaticLayout : TextPaint mTextPaint=new TextPaint(); StaticLayout mTextLayout = new StaticLayout("my text\nNext line is very long text that does not definitely fit in a single line on an android device. This will show you how!",

FFMpeg drawtext width?

冷暖自知 提交于 2021-02-07 10:59:28
问题 I'm using drawtext to print some text on an animated GIF. Everything is working, but I'm unable to specify a bounding box and make the text wrap. I'm currently using this: ffmpeg -i image.gif -filter_complex "drawtext=textfile=text.txt:x=main_w/2 - text_w/2:y=main_h/2 - text_h/2:fontfile=Roboto-Regular.ttf:fontsize=24:fontcolor=000000" image_out.gif Is there a way to wrap text? 回答1: You can use the FFmpeg subtitles filter for automatic word wrapping and to place the text in the middle center.

FFmpeg drawtext over multiple lines

蹲街弑〆低调 提交于 2020-08-02 03:23:15
问题 I have the code: import subprocess , os ffmpeg = "C:\\ffmpeg_10_6_11.exe" inVid = "C:\\test_in.avi" outVid = "C:\\test_out.avi" if os.path.exists( outVid ): os.remove( outVid ) proc = subprocess.Popen(ffmpeg + " -i " + inVid + ''' -vf drawtext=fontfile=/Windows/Fonts/arial.ttf:text="onLine1 onLine2 onLine3":fontcolor=white:fontsize=20 -y ''' + outVid , shell=True, stderr=subprocess.PIPE) proc.wait() print proc.stderr.read() os.startfile( outVid ) to write text to a video file. But I want to

FFmpeg drawtext over multiple lines

感情迁移 提交于 2020-08-02 03:20:02
问题 I have the code: import subprocess , os ffmpeg = "C:\\ffmpeg_10_6_11.exe" inVid = "C:\\test_in.avi" outVid = "C:\\test_out.avi" if os.path.exists( outVid ): os.remove( outVid ) proc = subprocess.Popen(ffmpeg + " -i " + inVid + ''' -vf drawtext=fontfile=/Windows/Fonts/arial.ttf:text="onLine1 onLine2 onLine3":fontcolor=white:fontsize=20 -y ''' + outVid , shell=True, stderr=subprocess.PIPE) proc.wait() print proc.stderr.read() os.startfile( outVid ) to write text to a video file. But I want to

FFmpeg drawtext over multiple lines

故事扮演 提交于 2020-08-02 03:19:12
问题 I have the code: import subprocess , os ffmpeg = "C:\\ffmpeg_10_6_11.exe" inVid = "C:\\test_in.avi" outVid = "C:\\test_out.avi" if os.path.exists( outVid ): os.remove( outVid ) proc = subprocess.Popen(ffmpeg + " -i " + inVid + ''' -vf drawtext=fontfile=/Windows/Fonts/arial.ttf:text="onLine1 onLine2 onLine3":fontcolor=white:fontsize=20 -y ''' + outVid , shell=True, stderr=subprocess.PIPE) proc.wait() print proc.stderr.read() os.startfile( outVid ) to write text to a video file. But I want to

FFmpeg drawtext over multiple lines

假装没事ソ 提交于 2020-08-02 03:18:20
问题 I have the code: import subprocess , os ffmpeg = "C:\\ffmpeg_10_6_11.exe" inVid = "C:\\test_in.avi" outVid = "C:\\test_out.avi" if os.path.exists( outVid ): os.remove( outVid ) proc = subprocess.Popen(ffmpeg + " -i " + inVid + ''' -vf drawtext=fontfile=/Windows/Fonts/arial.ttf:text="onLine1 onLine2 onLine3":fontcolor=white:fontsize=20 -y ''' + outVid , shell=True, stderr=subprocess.PIPE) proc.wait() print proc.stderr.read() os.startfile( outVid ) to write text to a video file. But I want to

C# OpenTK - Draw string on window

為{幸葍}努か 提交于 2020-05-09 08:38:07
问题 I've a big problem: I've an OpenTK window open where I draw textures, images, etc. I've to do a little videogame in this manner for a test and I'ld like to show text on it that shows game infos. Actually I've been only able to open a Window form with text and it's not what I need. Is there a manner to show text in a OpenTK window? I can't use OpenTK 3.0, so QuickFont has to be excluded. I can use GL Class. Thank you very much! 回答1: One possibility would be to use FreeType library to load a

Display text in a MFC application

若如初见. 提交于 2020-01-04 07:28:49
问题 I need to display text in an MFC application. I have a sample text like "Display text in mfc application". Let's assume the client window in which I intend to draw this text is so small(horizontally) that in one line the only text that can fit is "Display text in". The words "mfc application" are not displayed. My question is, how do I ensure that these words are displayed in the next line, instead of just being clipped off?I'm using the drawtext function to display the text. Thanks. 回答1: By

Drawing text on canvas with WINGDING.ttf font is not working on android

偶尔善良 提交于 2020-01-03 00:27:51
问题 When I am drawing Text with custom font(basically icon ex: WINGDING.ttf) using drawText is showing simple text as provided. Steps I followed: 1. Added font file to Assets folder 2. Set paint with the added font 3. drawing text with the paint To draw text I used the corresponding English character canvas.drawText("p",0,1, x, y, myPaint); This displays as p on app 回答1: use this way if you have assets/fonts: private Paint myPaint= new Paint(Paint.ANTI_ALIAS_FLAG); private Typeface mFace; mFace =

Add text with FFMpeg drawtext at specific time

帅比萌擦擦* 提交于 2019-12-30 13:31:46
问题 I'm adding text to an animated GIF. I would like the text to appear at a specific time, though, and I'm unable to do that. This is what I have: ffmpeg -i image.gif -vf 'drawtext=textfile=/path/to/text.txt:x=0:y=0:fontfile=/path/to/font.ttf:fontsize=64:fontcolor=white:borderw=3:bordercolor=black:box=0' I tried different approaches, but nothing seems to work. I can manipulate timing for the video using things like -itsoffset 00:00:30 , but not the text. 回答1: You have to use timeline editing.