| |
About
It’s not a label, it’s a lifestyle!
|
|
|
|
I received fifty mp3 files (legally), containing various speeches I intend to listen to. While they were accompanied by a listing of contents, dates and speakers, there was no apparent naming convention for the actual media files, and neither were the tagged properly.
With a little search/replace from OpenOffice Writer, I transformed the listing into a batch file of sorts, instructing lame to apply the proper tags. Alas, I couldn’t figure out how to tell it to just tag’em, thankyouverymuch. Lame insisted on recoding each file, which given the already low bandwith of those particular files, wasn’t something I wanted it to do.
Would you believe there aren’t any (windows-based!) utilities to tag mp3 files from the command line? Eventually I found one here, but it only knows ID3v1 tags. I was quickly able to tag all these files, and using tag’s –rentag function, I could also rename the files to something more manageable.
|
A friend of mine recently asked me to upload a bunch of files to his Gallery. The gotcha was that a large number of images was provided in PDF format. Don’t even ask why or how or where or whatever. What was needed, however, was a way to convert hundreds of PDF files into jpegs. Fear not, xPDF is here!
Foolabs‘ wonderful contribution to PDF bliss includes a little utility called pdftoppm, which will render any PDF into images, one page at a time. The resulting format is a ppm image file, as understood by another open-source package, netpbm. It contains the aptly-named pnmtojpeg, which will take the ppm file to new levels of compatibility.
Ain’t it great? We’re all done here. I cobbled together a quick batch file, zipped it up with supporting files and sent it off to my friend. The complete solution:
- mkdir a directory on a drive somewhere. Call it pdf2jpg or whatever you like.
- Download xPDF from here. Extract pdftoppm.exe into your target directory.
- Download netpbm from here or here. Extract jpegxx.dll, libnetpbmxx.dll and pnmtojpeg.exe into said directory.
- Take the batch file below and write it to pdf2jpg.bat. in the same directory.
- Zip all this stuff up for future use.
- Dump all your PDF files into this same folder and double-click pdf2jpg.bat.
Keep in mind that this is a bare-bones set-up, intended only to convert PDFs containing images into jpeg files. It should work on most other PDF files as well, but expect error messages and potential rendering issues when attacking V1.6 PDFs (created by Acrobat 7), as well as warnings for missing fonts.
Please email me back any changes or improvements you made to this, and/or let me know how you’re using it.
The code:
@echo off
if "%1"=="" GOTO :DoAll
echo Processing %1
set file=%1
set file=%file:~0,-4%
set root=%CD%\%file%
pdftoppm -q -f 1 -l 1 -r 96 %file%.pdf "%root%"
pnmtojpeg < %file%-000001.ppm > %file%.jpg
del %file%-000001.ppm
GOTO :End
:DoAll
echo Searching for PDF Files
for %%A IN (*.pdf) DO CALL pdf2jpg.bat %%A
:End
Download this code: pdf2jpg.bat
|
Of course, this is how it has to begin. Answers to your never-asked questions of Who? Why? How?
I’m a geek. And that’s perfectly ok. I’ve been working with computers for better than twenty years. I make my living in the world of programming, and have worked with a wide range of languages, concepts, technologies and people. I have a home-office stocked with a dozen working computers, and four or five more floating around the house. I have a total of 1.2TB of RAID5 storage in two servers, a dedicated computer to run the phones, 8.5kW of UPS capacity, three printers, scanners in the flatbed, sheet-fed and film variety, and bins full of parts. When I last took down my home-office for some re-arranging, I wound up with two 22-gallon totes full of cables. Re-wiring took the better part of a day.
It’s sick. It’s fun. If I had five more computers, I’d know what to do with those, too. I find myself in a spot where work and leisure have no perceivable distinction. I like what I do, and I do what I like. And somehow I manage to get paid for it. My wife understands, too. As long as the kids are fed and clothed, the lawn is mowed and there’s gas in the car, I’m free to accumulate more gadgets. Still, I manage to be thrifty with most of my purchases. Half of my computers are refurbs, the other is home-made. Most parts are bought with rebates, used or on ebay.
So, what’s this pointless bragging? Well, I really hope you don’t misunderstand this post as bragging. I’m not bragging about the hardware, I’m not even proud of the quantity. Sometimes I’m proud to have gotten a really good deal. I hope I can reach out to my fellow geeks and connect on our shared interest. And with all this gear here, there’s a lot of integration work going on. Making things work together, work better, or find completely new or unique uses for them. That’s what this blog wants to be about. Stuff I learn on the way, ideas that I have, successes and failures, and an occasional rant.
My intention is to share two or three tidbits each week. But keep in mind, you get what you pay for, and this is free.
|
|