Skip to main content

Photogenic

Ah, the wonders of an accessible command line! To think that some meat-head boasted about removing it from his OS? Anyway...

Was given the task of preparing some photos to be inspected & maybe used by an Eastern States co, one of the features being a photo release form — only available in PDF format.

So... fired up pdftohtml & now had an editable (not pretty, but close enough) HTML version of it. Easiest way to edit it was OpenOffice Writer, so done.

Difficulty was going to be getting mentions of each photo written into the form, so I left it saved as HTML, with a keyword plonked into the doc at the point where photo refs were going to appear, in a paragraph by itself. Now I can use gawk to search for that keyword & replace it with a table of image files (system “cat”).

So far, so good, but the image names weren’t regarded as distinctive enough by themselves, so out came identify (an ImageMagick tool) & md5sum so now each image has distinctive identification.

The next problem is HTML — while it displays just fine on someone’s browser, it also includes my signature as a raw image file. Not safe. So I dug around & found a PHP script (dompdf) which churns out PDFs from HTML. Fine idea, but it depended on a couple of libraries I don’t have handy, easiest correction being to break out the scalpel & remove the related sections of code. Done. Yes, I know that it’s still feasible to exculpate the image from a PDF (how else would it print out?) but it’s hard enough to stop the vast majority of readers.

Then I added a simple little script (32 sparse lines) to make thumbnails & display each section in a very simple index page, & another to churn out archives of the primary image files so the crew from the “largely unexplored” sections of Oz could grab a whole section at a time. tar plus gzip doesn’t beat proprietary-format zip noticeably for JPEG files, but bzip2 won by a few percent. BASH variable-processing features make selection & the like dead simple.

Then I reclined in the luxury of mod-cons: pushing 140MB to the web-server took only a few minutes (at about a 1.5 real megabits per second) over cheapo ADSL2 connections (wireless this end, wired that) via WAIX, a local exchange point which made the traffic effectively free.

I can sit dow, type one short command, & the whole lot can be re-done from that mysterious engineering substance, “scratch.”

Comments

Popular posts from this blog

new life for an old (FTX) PSU, improved life for one human

the LEDs on this 5m strip happen to emit light centred on a red that does unexpectedly helpful things to (and surprisingly deeply within) a human routinely exposed to it. it has been soldered to a Molex connector, plugged into a TFX power supply from a (retired: the MoBo is cactus) Small Form Factor PC, the assorted PSU connectors (and loose end from the strip) have been taped over. the LED strip cost $10.24 including postage, the rest cost $0, the PSU is running at 12½% of capacity, consumes less power than a laptop plug-pack despite running a fan. trial runs begin today.

every-application-is-part-of-a-toolkit at work

I have a LibreOffice Impress slideshow that I wish to turn into a narrated video. 1. export the slideshow as PNG images (if that is partially broken — as at now — at higher resolutions, Export Directly as PDF then use ‘pdftoppm’ (from the poppler-utils package) to do the same). 2. write a small C program (63 lines including comments) to display those images one at a time, writing a config file entry for Imagination (default transition: ‘cross fade’) based on when the image-viewer application (‘display,’ from the GraphicsMagick suite) is closed on each one; run that, read each image aloud, then close each image in turn. 3. run ‘Imagination’ over the config file to produce a silent MP4 video with the correct timings. 4. run ‘Audacity’ to record speech while using ‘SMPlayer’ to display the silent video, then export that recording as a WAV file. 4a. optionally, use ‘TiMIDIty’ to convert a non-copyright-encumbered MIDI tune to WAV, then import that and blend it with the speech (as a quiet b...

boundaries

pushing the actual boundaries of the physical (not extremes, the boundaries themselves) can often remove barriers not otherwise perceived. one can then often resolve an issue itself, rather than merely stonewalling at the physical consequences of the issue.