Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Insert the line number from text file to filename output Post 303024566 by Peasant on Thursday 11th of October 2018 05:04:19 AM
Old 10-11-2018
Try this :
Code:
while read word; do
i=$((i+1))
  convert  canvas.jpg \
\( -size 350x350 -background none \
-fill white -gravity center caption:"$word" -trim +repage -depth 8 \) \
-gravity center -composite $i.jpg
done < words.txt

cat and pipe is not needed here.

Regards
Peasant.
This User Gave Thanks to Peasant For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert text file at a certain line.

I need to insert a file called temp_impact (which has about 15 lines in it) to a file called 11.23cfg starting at line 33. I searched the forums and found the sed '34i\ test' 11.23cfg > newfile That will enter word test at the appropriate line, but i need the entire file dumped there. Any... (4 Replies)
Discussion started by: insania
4 Replies

2. UNIX for Dummies Questions & Answers

How to grep / zgrep to output ONLY the matching filename and line number?

Hi all, I am trying to zgrep / grep list of files so that it displays only the matching filename:line number and does not display the whole line, like: (echo "1.txt";echo "2.txt") | xargs zgrep -no STRING If I use -o option, it displays the matching STRING and if not used, displays the... (3 Replies)
Discussion started by: vvaidyan
3 Replies

3. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

4. Shell Programming and Scripting

Insert text at line number

I wrote a script to grep for a closing XML node. Then I need it to navigate up a line and insert some XML. Then go to the next occurrance. I have this INSERT_NODE='<QUANTITATIVE NAME="'${QR_NAME}'" QUANT="1" />' GREP_FOR='</JOB>' TMP_FILE=/tmp/lineArray.$$ if ]; then continue else ... (7 Replies)
Discussion started by: J-Man
7 Replies

5. Shell Programming and Scripting

Insert output into file at line number

I need to insert the output of a script into a specific line number of a txt file. I've read the Sed man page and searched the forums and it's not immediately clear how I would go about doing this. (4 Replies)
Discussion started by: pluto7777
4 Replies

6. Shell Programming and Scripting

Insert a variable to a text file after fixed number of lines

Hi, I am new to unix. I need to insert a variable which contains some lines of text into a text file after fixed number of lines.. Please help me on this.. Thanks in Advance, Amrutha (3 Replies)
Discussion started by: amr89
3 Replies

7. UNIX for Dummies Questions & Answers

Insert a line in a text file

I want to insert a line with text after the 9th line of a text file. How would I do this using sed or awk? (2 Replies)
Discussion started by: lost.identity
2 Replies

8. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies

9. UNIX for Beginners Questions & Answers

Insert a line of text on nth line of a file

Hi All, I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise My intention is to insert a line of text after 13th line of every file inside a particular directory. While trying to do it for a single file , i am using sed sed '3 i this is the 4th line' filename sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 Replies

10. Shell Programming and Scripting

Insert text at the beginning of every even number line

i am trying to insert text at the beginning of every even number line with awk i can do it with odd number lines with this command awk 'NR%2{$0="some text "$0}1' filehow can i edit this command thanks (5 Replies)
Discussion started by: bob123
5 Replies
jp2a(1) 							   USER COMMANDS							   jp2a(1)

NAME
jp2a - convert JPEG images to ASCII SYNOPSIS
jp2a [ options ] [ filename(s) | URL(s) ] DESCRIPTION
jp2a will convert JPEG images to ASCII characters. You can specify a mixture of files and URLs. OPTIONS
- Read JPEG image from standard input --background=light --background=dark If you don't want to mess with --invert all the time, just use these instead. If you are using white characters on a black display, then use --background=dark, and vice versa. -b --border Frame output image in a border --chars=... Use the given characters when producing the output ASCII image. Default is " ...',;:clodxkO0KXNWM". --colors Use ANSI color for text output and CSS color for HTML output. -d --debug Print debugging information when using libcurl to download images from the net. -f --term-fit Use the largest dimension that makes the image fit in your terminal display. --term-height Use terminal display height and calculate width based on image aspect ratio. --term-width Use terminal display width and calculate height based on image aspect ratio. -z --term-zoom Use terminal display width and height. --fill When used with --html and --color, then color each output character's background color. For instance, if you want to use fill-out- put on a light background, do jp2a --color --html --html-fill --background=light somefile.jpg --output=dark.html To do the same on a light background: jp2a --color --html --html-fill --background=dark somefile.jpg --output=light.html The default is to have fill disabled. -x --flipx Flip output image horizontally -y --flipy Flip output image vertically --height=N Set output height. If only --height is specified, then output width will be calculated according to the source images aspect ratio. -h --help Display a short help text --grayscale Converts image to grayscale when using --html or --colors. --html Make ASCII output in strict XHTML 1.0, suitable for viewing with web browsers. This is useful with big output dimensions, and you want to check the result with a browser with small font. --html-fill Same as --fill. You should use that option instead. --html-no-bold Do not use bold text for HTML output. --html-raw Output only the image in HTML codes, leaving out the rest of the webpage, so you can construct your own. --html-fontsize=N Set fontsize when using --html output. Default is 4. --html-title=... Set HTML output title. --output=... Write ASCII output to given filename. To explicitly specify standard output, use --output=-. -i --invert Invert output image. If you view a picture with white background, but you are using a display with light characters on a dark back- ground, you shoudl invert the image. --red=... --green=... --blue=... When converting from RGB to grayscale, use the given weights to calculate luminance. These three floating point values must add up to exactly 1.0. The default is red=0.2989, green=0.5866 and blue=0.1145. --size=WIDTHxHEIGHT Set output dimension. -v --verbose Print some verbose information to standard error when reading each JPEG image. --width=N Set output width. If you only specify the width, the height will be calculated automatically. -V --version Print program version. --zoom Sets output dimensions to your entire terminal window, disregarding source image aspect ratio. RETURN VALUES
jp2a returns 1 when errors are encountered, zero for no errors. EXAMPLES
Convert and print imagefile.jpg using ASCII characters in 40 columns and 20 rows: jp2a --size=40x20 imagefile.jpg Download an image off the net, convert and print: jp2a http://www.google.com/intl/en/logos/easter_logo.jpg Output picture.jpg and picture2.jpg, each 80x25 characters, using the characters " ...ooxx@@" for output: jp2a --size=80x25 --chars=" ...ooxx@@" picture.jpg picture2.jpg Output image.jpg using 76 columns, height is automatically calculated from aspect ratio of image.jpg cat image.jpg | jp2a --width=76 - If you use jp2a together with ImageMagick's convert(1) then you can make good use of pipes, and have ImageMagick do all sorts of image con- versions and effects on the source image. For example: convert somefile.png jpg:- | jp2a - --width=80 Check out convert(1) options to see what you can do. Convert can handle almost any image format, so with this combination you can convert images in e.g. PDF or AVI files to ASCII. Although the default build of jp2a includes automatic downloading of files specified by URLs, you can explicitly download them by using curl(1) or wget(1), for example: curl -s http://foo.bar/image.jpg | convert - jpg:- | jp2a - DOWNLOADING IMAGES FROM THE NET
If you have compiled jp2a with libcurl(3), you can download images by specifying URLs: jp2a https://user:pass@foo.com/bar.jpg The protocols recognized are ftp, ftps, file, http, https and tftp. If you need more control of the downloading, you should use curl(1) or wget(1) and jp2a read the image from standard input. jp2a uses pipe and fork to download images using libcurl (i.e., no exec or system calls) and therefore does not worry about malevolently formatted URLs. GRAYSCALE CONVERSION
You can extract the red channel by doing this: jp2a somefile.jpg --red=1.0 --green=0.0 --blue=0.0 This will calculate luminance based on Y = R*1.0 + G*0.0 + B*0.0. The default values is to use Y = R*0.2989 + G*0.5866 + B*0.1145. PROJECT HOMEPAGE
The latest version of jp2a and news is always available from http://jp2a.sourceforge.net SEE ALSO
cjpeg(1), djpeg(1), jpegtran(1), convert(1) BUGS
jp2a does not interpolate when resizing. If you want better quality, try using convert(1) and convert the source image to the exact output dimensions before using jp2a. Another issue is that jp2a skips some X-pixels along each scanline. This gives a less precise output image, and will probably be corrected in future versions. AUTHOR
Christian Stigen Larsen <csl@sublevel3.org> -- http://csl.sublevel3.org jp2a uses jpeglib to read JPEG files. jpeglib is made by The Independent JPEG Group (IJG), who have a page at http://www.ijg.org LICENSE
jp2a is distributed under the GNU General Public License v2. version 1.0 September 4, 2006 jp2a(1)
All times are GMT -4. The time now is 04:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy