Looking for writing-related posts? Check out my new writing blog, www.larrykollar.com!

Wednesday, December 12, 2018 No comments

Adventures of a #techcomm Geek: Blurrier Image

In today’s installment of Life of a #techcomm Geek, we return to a subject that draws this geek like a moth to flame: file conversions. Hazardous, yet compelling. Lots of geeky stuff follows…


I’ve had this particular line in my Tines to-do list for a while. As part of our transition to a new documentation system, I and another writer handled the conversions. We had a high-end tool to help us out, although creating rules was a dicey proposition and the vendor ended up helping (we made tweaks where they could make an obvious difference, though).

In the most recent round, we got to the FrameMaker-based docs. Frame (as its users often nickname it) is unique in that it allows overlaying callouts and other graphic elements on top of images. This is a huge help for translating manuals, because the writers don’t have to maintain a separate set of graphics for each language. Anyway, since the new system isn’t FrameMaker, something else had to happen. The conversion system could be configured to either flatten the images (convert to a PNG, rasterizing the callouts) or create an SVG (Structured Vector Graphics). We chose the latter, thinking that since SVG is an XML format, the new system could maintain them easily.

We were wrong.

Long story shortened considerably, we eventually threw up our hands and decided to convert all the SVGs to “flattened” PNG files. The writers would keep the SVG files on their hard drives to make changes, then upload a new flattened PNG when needed. I wrote a script to do the deed; it crunched through hundreds of SVGs at about one per second, and updated all the links in the book to point to the new PNGs.

All well and good, until one of the writers went to publish. “The images look blurry,” she told me. Taking a look, she was obviously right. It took me about three seconds to figure out why.

You see, our SVG files have a width attribute, which was set to the width in the original FrameMaker files (a typical width is 576 pixels, which at 96dpi is 6 inches even). All well and good, but the original images run about 1200 pixels wide—so in essence, we were throwing away over ¾ of the image data when doing the conversion. No wonder it looked blurry! But we were all weary of messing with it by that point; I had written scripts that:

  • extracted embedded images from an SVG, converted them to PNG, then changed the link so the SVG referred to the file instead
  • went the other way, embedding images in an SVG
  • converted the entire mess to PNG in one swell fwoop

The documentation work that was my primary job function had been back-burner’ed for too long. I added an “investigate this further” item to my backlog list and got back to the bread-and-butter part of my job.

This week, I all but cleared a fairly long to-do list in three days, so I thought maybe I could give this thing another shot. A quick Google turned up some promising code on superuser.com; I divided the image width by the scaled-down width in one SVG, applied the script, and got a nice sharp image! The only problem with that is, it would take about 10 minutes to do each file by hand, and there are hundreds. A script is the only practical way to blast through all of them.

When I tackle a situation like this, I tend to use a shell script to drive awk, Perl, and XSLT scripts. Each has its strengths, and trying to force (say) XSLT to work some of awk or Perl’s string-processing magic is more trouble than it’s worth. And vice versa. So… XSLT to extract the file name and (scaled) width, awk to parse the output of file (a utility that returns the dimensions of an image file) and do the calculations, all wrapped up in a shell script to conduct the Geek Orchestra.

Of course, I ran out of time this afternoon to put the whole thing together, but I have all the sub-script logic down. I just need to score the symphony. That will likely take me to noon tomorrow, then I’ll be back to bugging people already bogged down with too much stuff to lend me their expertise.

I also achieved Inbox Zero at work today… and that’s a rant for another time.

Friday, December 07, 2018 2 comments

A TB02 of sorts…

A long time ago, back when The Boy had more than his share of teen angst to deal with, I had a series of “TB” error codes. TB02 was “He moved back home (again).” (Dang… this blog is old. 13 in Internet years is like “going out for lunch meant we hunted wild tacos with spears.”)

Fast-forward to now. He’s married, living in his own house, starting a business, and doing a decent job of adulting. Unfortunately, he ended up with some health issues that put him in the hospital for the better part of two weeks (not his foot this time). During that time, his wife & his mom got together and really kept things going, spending days and nights with him, making sure he was being taken care of—I was thrilled at how well they worked together. Still, he was bored $#¡+less, and was more than ready to get outta there and get back to his life.

Yesterday, they sprung him, but with a condition: he can’t be left by himself for a week. The daughter in law has to work (hey, I totally understand, because I do too)—so he’s here at FAR Manor. He’s not really moving back in, just hanging out with us for a week, so it’s not a real TB02. I’m sure Mason is happy to have him around, because he was supposed to stay with his dad for a few days Thanksgiving week, but with one thing or another, I haven’t gotten home before Mason was asleep in bed.

Yeah, The Boy missed Thanksgiving, but I think we’re going to have an extra dinner this weekend. After all, we really have something to be thankful for this time.

Wednesday, December 05, 2018 No comments

When you go to the delicatessen store…

I’m one of those people who like liverwurst. Always have. I gave it up for a while, what with the weight gain and high blood pressure, but Boar’s Head came out with a lite version the has lots less fat and sodium, and is still pretty tasty.

A few weeks ago, I got a quarter pound. As the deli guy was slicing it up, I thought, “Hey, Charlie likes food with this texture. I wonder if he’d like this.” So the next evening, I made him a sandwich and offered the corner.

NOM!
Charlie likes sandwiches okay. But when he got a taste of this, he grabbed it out of my hand and gobbled it down. Now up to this point, whenever he got hold of a sandwich, he would open it up, remove the meat, and eat the bread. Not this time, or any time since! The experiment was a roaring success, and I might have got one sandwich out of the batch.

So I found myself at the grocery store a few days later. I got half a pound this time, figuring maybe I could sneak a sandwich or two for myself. I came home and told the wife I got Charlie and me some liverwurst. Charlie heard this, and pushed me into the kitchen. “It doesn’t matter if I just ate or not, I want some of that good stuff!” Next time, Charlie was with me, and he got the sample slice (plus a slice of beef bologna, which he also liked pretty well).

Once again, we were out. I picked up Charlie from daycare on the way home from work this evening, and decided to grab a whole pound this time (because I still only get two sandwiches out of a half pound after Charlie gets through with it). We headed toward the deli, and he pointed and hooted, remembering how he’d scored a freebie last time. Once again, he got the sample. He finished it while they were slicing the cheese, and he signed “more.” Sure, why not? A couple pieces of liverwurst won’t hurt anything.

But he wasn’t through. As I rolled through the store on the way to grab a box of diapers, he wanted another piece. And another. And one more at the checkout. Then, when we got home, he devoured all but two bites of a peanut butter sandwich.

So when you go to the delicatessen store, grab another pound of liverwurst for Charlie and me. What we have now won’t stay around long.

Monday, December 03, 2018 No comments

Mason Minecraft Mondays

Mason took to Minecraft like a natural-born bricklayer. He comes up with some rather interesting constructs from time to time, and we’ve talked for a while about posting some screenshots. Today’s the day…

The aerial view of his seaside croft, built around a waterfall. Left to right: barn, house, garden.



This is the barn at the entrance. Mason tells me the chimney-looking thing on top is decorative. I suppose it makes it easier to spot from out at sea.


Over on the other side of the house is the garden. The stream runs alongside it, leading to the waterfall. This POV is over the stream, looking toward the ocean.


In the house, Mason has a spacious kitchen. His rooms tend to be large, and why not? In real life, it would give him more room to run around flat-out, with Charlie right behind him.


After filling up on pork chops and a variety of fresh veggies, and racing around the place, perhaps a nap is in order. The bedroom is appointed with the necessities. Left to right: computer, bed, storage containers for clothing and such.


Looks like a peaceful place to spend a long vacation to me. When I come back, I’ll bring you some more Mason Minecraft Mondays.

LinkWithin

Related Posts Plugin for WordPress, Blogger...