# Tag Info

41

In bash: for f in *.jpg; do convert ./"$f" ./"${f%.jpg}.pdf" done

40

You can use the mogrify command for this. Normally, it modifies files in-place, but when converting formats, it writes a new file (just changing the extension to match the new format). Thus: mogrify -format pdf -- *.jpg (Like enzotib's ./*.jpg, the -- prevents any strange filenames from being interpreted as switches. Most commands recognize -- to mean ...

37

Last time I used convert for such a task I explicitly specified the size of the destination via resizing: $convert a.png b.png -compress jpeg -resize 1240x1753 \ -units PixelsPerInch -density 150x150 multipage.pdf Where 1240x1753 are exactly DIN A4 when 150 DPI is chosen. I computed the values using bc and looked up the dimensions ... 34 It's not clear what you mean by "quality loss". That could mean a lot of different things. Could you post some samples to illustrate? Perhaps cut the same section out of the poor quality and good quality versions (as a PNG to avoid further quality loss). Perhaps you need to use -density to do the conversion at a higher dpi: convert -density 300 file.pdf ... 33 Here's a small Python script using the PyPdf library that does the job neatly. Save it in a script called un2up (or whatever you like), make it executable (chmod +x un2up), and run it as a filter (un2up <2up.pdf >1up.pdf). #!/usr/bin/env python import copy, sys from pyPdf import PdfFileWriter, PdfFileReader input = PdfFileReader(sys.stdin) output = ... 22 convert is a handy command line tool to do that. cd to the folder containing your png-files and run this command: convert -delay 10 -loop 0 *.png animation.gif Source: http://ubuntuforums.org/showthread.php?t=1132058 20 take a look at this: http://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735 ..... After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory. On a terminal: mplayer -ao null <video file name> -vo ... 16 OpenOffice comes with the unoconv program to perform format conversions on the command line. unoconv -f csv filename.xlsx For more complex requirements, you can parse XLSX files with Spreadsheet::XLSX in Perl or openpyxl in Python. For example, here's a quickie script to print out a worksheet as a semicolon-separated CSV file (warning: untested, typed ... 15 Newer versions of ffmpeg have no -sameq (see faq) but do have GIF support. ffmpeg -i %03d.png output.gif Where %03d is the frame ID in 3 digits. You may also try to use ffmpeg to create a movie out of a sequence of images and then convert the movie to a GIF animation (again using ffmpeg). # cf. http://pages.uoregon.edu/noeckel/MakeMovie.html # ... 13 pandoc can do this. It's more focused on converting marked-up text to various formats, but it should have no problems with simple plaintext. pandoc input.txt -o output.pdf 13 What you really want to use is:$ convert a.png b.png -compress jpeg -resize 1240x1753 \ -extent 1240x1753 -gravity center \ -units PixelsPerInch -density 150x150 multipage.pdf -extent actually extends the image to be 1240x1753, while -resize keeps the image's ratio, fitting it into either 1240x... or ...x1753. ...

13

faster and less painful syntax: parallel convert '{} {.}.pdf' ::: *.jpg Runs in parallel (using https://www.gnu.org/software/parallel/).

12

xxd -b (source)

12

In my case, using ffmpeg directly did the trick and provided the best result: $ffmpeg -f gif -i infile.gif outfile.mp4 12 Use the convert command from ImageMagick: convert x.png -resize 25% x.jpg will create a 25%-scaled JPEG version of x.png. To do all the PNG files at once, use a for loop: for filename in *.png ; do convert "$filename" -resize 25% "${filename%.png}.jpg" ; done We look at every file matching *.png, and for each one run the convert command above. ... 11 Here is a way that combines the best of the above suggestions into a simple, efficient, robust command line: find /path/to/files -iname '*.jpg' -exec mogrify -format pdf {} + It works fine with filenames that begin with a - or contain spaces. Note the use of -iname which is the case-insensitive version of -name so it will work on .JPG just as well as ... 11 (adapted from comments above) Depending on the codecs used (some codecs are incompatible with some containers), you could always simply copy the streams (-codec copy). That is the best way to avoid quality changes, as you're not reencoding the streams, just repackaging those in a different container. When dealing with audio/video files, it is important to ... 11 potrace I found this example on SO in a Q&A titled: How to convert a JPEG image into SVG format using ImageMagick?. One of the answers suggested potrace.$ convert input.jpg output.ppm $potrace -s output.ppm -o svgout.svg Results ... 10 The fundamental tool for sound format conversions and simple transformations is SoX, the Swiss Army knife of sound-processing programs. sox foo.mp3 foo.flac If you're running Debian, support for writing MP3 in sox is broken in lenny and squeeze (and as far as I know the same problem affects Ubuntu 10.04 and 10.10). This bug was fixed in early March 2011, ... 10 Just an addition since I had issues with the python script (and several other solutions): for me mutool worked great. It's a simple and small addition shipped with the elegant mupdf reader. So you can try: mutool poster -y 2 input.pdf output.pdf For horizontal splits, replace y with x. And you can, of course, combine the two for more complex solutions. ... 10 The convert's --delay option only applies to the next image on the command line. So convert -delay 10 * will only set the delay of the first frame to 0.1 second. The option need to be repeated: convert$(for a in *; do printf -- "-delay 10 %s " $a; done; ) result.gif For your sorting need, convert does not sort frames, the shell globing * does. If you ... 10 One way is to use pdflatex instead of convert. You need in a extra file, which is here called image.tex: \documentclass{article} \usepackage[active,tightpage]{preview} \usepackage{graphicx} \PreviewMacro[{*[][]{}}]{\includegraphics} \begin{document} \includegraphics{img.jpg} \end{document} Then run pdflatex image.tex to generate image.pdf. 10 found a solution: identify, part of the imagemagick package, does exactly what I need$ identify color.jpg > color.jpg JPEG 1980x650 1980x650+0+0 8-bit DirectClass 231KB 0.000u 0:00.000

9

One method is to use CUPS and the PDF psuedo-printer to "print" the text to a PDF file. Another is to use enscript to encode to postscript and then convert from postscript to PDF using the ps2pdf file from ghostscript package.

9

LibreOffice / OpenOffice as well as most other word processors (Abiword) can do this quite easily. There is a little utility called unoconv that uses the LibreOffice code base to do file format conversions on the command line. It can read and write any combination of formats that LibreOffice can and makes it very easy to do things like doc to pdf ...

8

Imagemagick can do it in one step: \$ convert in.pdf -crop 50%x0 +repage out.pdf

8

Ok, first things first... ffmpeg's sameq option doesn't mean same quality, and in many cases will not do anything relevant. This is from the ffmpeg man page: -sameq Use same quantizer as source (implies VBR). This is actually from the ffmpeg online documentation ‘-same_quant’ Use same quantizer as source (implies VBR). Note that this is NOT ...

8

First of all, -aq sets a quality-based variable bit rate - I think you're looking for -ab (note that I'm an ffmpeg user, so my knowledge of avconv syntax is limited - I've no idea how far it's drifted since the fork). Regardless, the built-in avconv/ffmpeg AAC encoder is pretty bad. fdk_aac The only really good AAC encoder for avconv/ffmpeg is libfdk_aac ...

7

By default, iconv refuses to convert the file if it contains characters that do not exist in the target character set. Use //TRANSLIT to “downgrade” such characters. iconv -f utf-8 -t iso8859-1//TRANSLIT

Only top voted, non community-wiki answers of a minimum length are eligible