# Tag Info

## Hot answers tagged conversion

24

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 ...

22

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 = ...

16

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 ... 12 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 ... 10 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 ... 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. 9 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 ... 9 I am almost certain that what you perceive as a loss of quality in the PDF, is just an effect of your PDF viewer's anti-aliasing feature. If you use evince to view the PDF, you can see the anti-aliasing feature automatically switched off at a certain zoom (300% in my quick test). You can see that vividly when you keep zooming in - you will notice that at ... 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 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 ... 8 (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 ... 7 The fundamental tool for sound format conversions and simple transformations is SoX, the Swiss Army knife of sound processing programs. sox foo.mp3 foo.flag 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, ... 6 It is a double byte format, probably UTF-16. See if you can identify a BOM (Byter Order Mark) header at the beginning of the file. This will tell you the encoding if it is present, although it may not be. Note that a text editor may hide this from you, so you will probably need to look at the file with a hex dump utility such as od or something similar to ... 6 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. 6 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 ... 5 I'm using Perl's xls2csv to convert xls files to csv. Not sure tho if it works with xlsx too. About: It can't be comma separated unfortunately since some columns have commas in them that's why quoting has been introduced: 1,2,"data,data, more data" 5 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 # first convert an image sequence to a movie ffmpeg -sameq -i %03d.jpg output.mp4 # ... and then convert the movie to a GIF animation ffmpeg -i output.mp4 ... 5 You can do this using bsdtar: ire@localhost: bsdtar -cvf pax.tar --format=pax @gnu.tar ire@localhost:file gnu.tar gnu.tar: POSIX tar archive (GNU) ire@localhost:file pax.tar pax.tar: POSIX tar archive @archive is the magic option. From the manpage: @archive (c and r mode only) The specified archive is opened and the entries in it will be ... 5 With a recent version of xclip (the -t option was added in 2010 but not released yet AFAICT, so you'd need to get it from subversion, or use the one packaged in Debian). xclip -o -selection clipboard -t text/html | pandoc -r html -w markdown And if you want to make that back into the clipboard: xclip -o -selection clipboard -t text/html | pandoc -r ... 4 sox version 13 and up supports FLAC, along with many other formats. sox can do many things to an audio file, not just convert from one format to another. It is to audio what ImageMagick is to graphics. 4 I've become a very avid fan of handbrake - which comes in windows and linux flavors, with or without GUI - mostly because when I rip DVDs it's generally to load the movies onto my iPad, and handbrake comes with a set of presets for exactly that purpose, but it supports pretty much every format known to it or the underlying transcode layer. 4 The perl CGI module has a escapeHTML function that makes it pretty easy: perl -e 'use CGI qw(escapeHTML); print escapeHTML("<hi>\n");' Or to do an entire file: perl -p -e 'BEGIN { use CGI qw(escapeHTML); }$_ = escapeHTML($_);' FILENAME 4 ImageMagick's Convert command can help you to crop your file in 2 parts. See http://www.imagemagick.org/Usage/crop/ If I were you, I'd write a (shell) script like this: Split your file with pdfsam: 1 page = 1 file on disk (Format doesn't matter. Choose one that ImageMagick knows. I'd just take PS or PDF. For each page, crop the first half and put it to a ... 4 Just use the text2pdf , which is free and opensource. At the link you can download the source or the pre-compiled binary for windows, solaris, dos. I'm able to use it into AIX OS without problem. Very simple to compile , just save the text2pdf.c and Makefile into the same directory and type make. (here I set the variable CC=gcc on AIX, on linux this will ... 4 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 ... 4 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. ...

4

Depending on how your original file was encoded, it may not be possible to keep the file size. ffmpeg -i infile.avi youroutput.mp4 should keep frame sizes and rates intact while making an mp4 file. ffmpeg -i infile.avi will give you information about your input file - the frame size, codecs used, bitrate, etc. You can also play with the acodec and ...

4

You want to use pptHTML: http://www.ma.utexas.edu/restricted-resources/utma-doc/xlHtml/pptHtml.txt For debian based distros: http://packages.debian.org/unstable/utils/ppthtml The C Source for the xlhtml package: http://prdownloads.sf.net/chicago/xlhtml-0.4.9.3.tgz ppthtml is an executable installed through the same package.

4

Both ext3 and ext4 are journaling filesystems, in addition this list several differences, the most relevant are: Maximum individual file size can be from 16 GB to 16 TB Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte). Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 ...

4

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 ...

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