How to include Timing Diagrams in a post

I was recently asked in a PM about how I made timing diagrams in this and other posts, so I thought I'd post it here.

I started with WaveDrom. The Tutorial page is very "dense" with information: every feature is described, but it is sometimes difficult to figure out how to make it draw what you want. I do most of the work in the Editor page, then save the textual JSON on my computer for later use.

If the drawing on that page is good enough, I just take a screen shot (CTRL-ALT-PRINT on a PC) and paste it into GIMP for cropping and saving as a JPG.

There are times when I can't quite get it to do what I want, or the layout is too cluttered. Fortunately, WaveDrom can export to an SVG file. That allows me to edit the graphics with InkScape. I can add, delete or modify pieces in the drawing. It is interesting to see how the author structured the drawing, but it can be tedious to dig down into the many nested groups to find a piece. When the drawing looks good, I do File/Export Bitmap, which saves it as a PNG. Then I open it with GIMP and Export it as a JPG.

Once you've got it as a JPG, you can upload it to an image-sharing site (Picasa, Photobucket, imgur, etc.) and use its URL in an [nobbc][img][/nobbc] tag, or use the technique described here.

Cheers,
/dev

I do File/Export Bitmap, which saves it as a PNG.

That's a bit like expecting analogRead() to get data from the serial port.

PaulS:
That's a bit like expecting analogRead() to get data from the serial port.

I don't follow.

PNG and a bitmap are both image files.

I'd be surprised if the PNG image didn't convey the timing information as well as the bitmap. A timing diagram seems like a great candidate for image compression.

/dev:
Then I open it with GIMP and Export it as a JPG.

You can skip the conversion to JPG if you want. You can attach PNG files.

FileTypesPng.PNG

I think PNG compression is better than JPG compression when it comes to diagrams.

Sure, I know you can attach PNGs, I just prefer JPGs. Whatevs.

I'd be surprised if the PNG image didn't convey the timing information as well as the bitmap.

Hmm, not sure what you mean here, as the timing information is (mostly) lost when WaveDrom exports it to SVG as a bunch of graphics lines, areas and text objects. There is a little info in the IDs, and there are "macros" for certain signals, but nothing like what was in the JSON.

@PaulS, I don't get your comment either. You do know SVG is a structured graphics format, not raster data, right? Last I looked, different browsers had different levels of support for SVG. Chrome seems to be good enough, though. Or maybe you just forgot a smiley again?

DuaneDegn:
I don't follow.

I think I do now.

The concern wasn't the conversion from bitmap to png file, the concern (or so I assume) was converting the timing data into a bitmap.

The "analogRead()" comment now makes sense.

/dev:
Sure, I know you can attach PNGs, I just prefer JPGs. Whatevs.

I'm under the impression JPG compression leaves annoying artifacts when done on diagrams. I thought JPG was best suited for photographs where high frequency changes are often not important to the content of the image. High frequency changes are important to text and diagrams. (I watched two computerphile videos on the subject so know I consider myself an expert. :slight_smile: )

The concern wasn't the conversion from bitmap to png file, the concern (or so I assume) was converting the timing data into a bitmap.

I don't understand why a menu item called "Export Bitmap" would create a PNG file.

I don't understand why a menu item called "Export Bitmap" would create a PNG file.

Oh, I see. As in a "Windows BitMaP" file, a .BMP? LOL, I guess I'm showing my age. I've always used "bitmap" in the generic sense: an array of pixels.

geezer:
Whyyyy, I remember when they first invented bitmaps. The pixels were black, or they were white. Aaaaaand we were grateful!

To me, the menu item means "Convert the vector information (cartesian coordinates) to raster information (bitmaps)". InkScape can only save the "rasterized" picture in the PNG file format, but it can export many vector file formats, including SVG, PDF, Windows Metafile and TeX.

Cheers,
/dev