Skip to content

graphics and image processing Notes

Chris Jones edited this page Apr 15, 2020 · 52 revisions

Contents

Recording Terminal Screencasts

asciienma is a popular CLI utility for recording terminal based screencasts which becomes quite handy when describing and demoing different terminal based applications.

To record an ASCII screencast that can be later uploaded to asciinema.org

asciinema rec -i=2 /path/to/store/cast/file.json

To stop the recording

control + d

To playback the newly recorded asciicast / screencast recorded with asciinema

asciinema play /path/to/recorded/movie.cast

To convert the above recording to animated GIF, which useful when opening a GitHub issue, and you don't want to link to an external site, but rather show the usage behavior in the current issue page internally on GitHub.

cd /opt/docker
echo "must cd into a directory that is bind mounted within the docker settings"
docker run --rm -v $PWD:/data asciinema/asciicast2gif:latest -s 2 recording.cast file.gif

Gotchas

❗️❗️❗️ November 4, 2019

asciicast2gif has serious issues if trying to convert a cast file with several hundred frames, ie. ~ a cast larger than a minute or so, that said there is a updated command to allow asciicast2gif handle the larger file sizes.

  • πŸ’‘ ran into issues with specifying a fully qualified path to the .cast/.json file, so for time being copy file into same directory, ie. /opt/docker for ease of use
cd /opt/docker
echo "cmd for working with large cast files"
docker run --rm \
-e "GIFSICLE_OPTS=--lossy=80" \
-e "NODE_OPTS=-max-old-space-size=12288" \
-e "MAGICK_MEMORY_LIMIT=6gb" \
-e "MAGICK_MAP_LIMIT=12gb" \
-v $PWD:/data asciinema/asciicast2gif -s 2 input.{cast,json} output.gif

Example

large asciicast converted to gif

Much thanks goes this comment on the issue tracker for asciicast2gif

❗️ The docker container running the process of converting the asciicast to a GIF will not be able to access files outside a shared directory / volume docker has read/write access to. For my particular use case I have /opt/docker directory that can be bind mounted within a docker container, so the container and read and write files on the host system.

The above GIF conversion command relies on some form of a docker daemon being accessible from the working computer.

If the animated GIF requires further editing then GIMP is a suitable solution for editing the individual frames of a GIF file.

A couple quick notes about editing a GIF in GIMP, when scrubbing the GIF playback using external Animation filter, d is used to step back a frame, and f is used to step forward a frame. Also, to crudely playback an animation within GIMP itself, I set a custom keyboard shortcut of v to toggle the visibility of a layer, which can be used with the arrow keys to pseudo play animation in GIMP. This is useful when deleting excess frames to make a terminal GIF cast more terse because the layer names will not correspond to the animation playback frames, which becomes annoying when trying to selectively delete erroneous frames / layers from an animated GIF.

Working with digital cameras

iPhone 6

The iPhone 6 includes a 8 megapixel camera on the back side of the phone. When the phone is held in the vertical position it takes a picture with a aspect ratio of 3 : 4 with ~ 2448 pixels wide by 3246 pixels high.

Digital Imaging Useful Links

Working with raster images

To display metadata for a particular image

identify /path/to/file.jpg

To remove all metadata from a raster image

exiftool -all= -overwrite_original /path/to/file.jpg

Working with Inkscape πŸ”

Newer version of Inkscape provide a setting within the document properties to the document to the size of a rectangular outline of the largest object within the document.

File > Document Properties...

Working with Layers in Inkscape

To crop the content of object / layer of that of another object within the same layer use,

Object -> Clip -> Set

Make sure the object / layer to be clipped is selected 2nd

credit

The easiest way I know to send the selected objects to a specific layer in Inkscape is to cut βœ‚οΈ the current selection ctrl+x then select the desired layer and paste in the selection.

Working with text in Inkscape

If text does not appear to render when viewing an svg in a web browser then try the following.

  1. Select the text from the appropiate layer.
  2. With the text object selected, Select the Text menu item, then select Convert to Text

GIMP

GIMP supports custom paths for scripts

gimp-script-path

Per the GIMP documentation on the gimp.org website, GIMP supports a per user configuration file, ie. a RC file in

$HOME/.gimp-2.[MINOR_VERSION]/gimprc

Ex

$HOME/.gimpr-2.10/gimprc

The GIMP scripts, .scm contained within this dotfiles repo are contained within $HOME/.config/GIMP/2.10/scripts/

GIMP > Working with guides

writting this down ...finally because I always have to relearn how to do this

To move a guide in GIMP hold down the shift with the mouse cursor over the guide, and when the guide color changes from blue to red, then the guide can be moved using the mouse.

GIMP > Animated GIF

In short when exporting a an xcf to an animated GIF

When exporting .xcf to an animated GIF the GIF file format can work with GIMP layer groups thus merge all layers in a group to a single layer before exporting.

frame 3 (1000ms)
frame 2 (1000ms)
frame 1 (1000ms)

ImageMagick

To convert / create a PDF from a sequence of images using ImageMagick

convert 01.jpg 02.jpg 03.jpg 04.png 05.bmp output.pdf

ImageMagick Useful Links

Working with 3D Software

πŸ’‘ tip when working with STL files, meshes are tessellated using triangles as opposed to quads.

Working with Blender 2.80

Blender 2.80 > User Preferences

IMHO a more natural workflow is use perspective view orbiting within a scene, and use orthographic when viewing a scene from top bottom front and sides

To make Blender perform the switch from ortho to perspective automagically

Edit β†’ Preferences β†’ Navigation β†’ Orbit and Pan β†’

  • Auto Perspective

thank you

Blender 2.80 > Gotchas

Opening multiple instances of a Blender.app on macOS require launching the blender binary from a CLI. An advantage of launching Blender.app from the blender binary contained within the app bundle is multiple .blend files can be opened simultaneously.

Blender 2.80 > Modeling Concepts

If an edge needs to be constructed to between two vertices where an edge does not exist

  1. Select both vertices obviously in edit mode
  2. Press the f key or choose the fill option from a menu

A edge should appear between the two selected vertices, ie. connecting the verts.

Blender 2.80 > Keybindings

  • tags #blender #2.80 #key #keybindings #keyboard #shortcut #shortcuts

To quickly display the snapping menu underneath the cursor

shift + control + tab

To move the cursor in Blender to position under the mouse cursor πŸ–± within a 3D Viewport

shift + RMB

To cycle between vertex, edge, face selection

1, 2, 3

To repeat the previous selection in a 3D View

shift+r

To toggle x-ray mode in Blender on macOS

alt + z

To toggle the viewport from single view to quad view

control + alt + q

todo insert explanation gif

Blender > 2.80 > Preparing a model for 3d printing

  • make sure the model does not have double / duplicate verticies
  • make sure the model does not contain any manifolds
Blender > 2.80 > Exporting a model / mesh for 3d printing
  • tags #stl #export #exporting #3dprinting #3d-print

    In order to preserve scale of a model that has been made using Blender a couple of settings need to be adjusted.

    ❗️ Most if not all 3D printers work on a mm milimeter measurement / sizing scale.

    ❗️ stl files do not conform to a specific unit for model sizes, ie. a stl does not know what a blender unit is.

  • Make certain the Units within the Properties > Scene Editor is set to Metric and the Unit Scale is set to 0.001

  • ❗️ If exporting a single object, ie. only the selected object within a scene the scale of the object may need to be adjusted itslef.

    • When I was modeling a M8 nut the scale of the nut was NOT correct using a Unit Scale of 0.001, however scaling the nut constructed using Bolt Factory 10x dialed the size of the nut for experimenting with 3d printing.

      blender export stl settings

      When exporting a model / mesh to an stl file to be opened in Cura set the following export settings

  • Scale 1.0

  • ❗️ make certain scene unit is not checked when exporting.

    blender properties editor

Working with Blender 2.79

Working with Editors

  • Editors in Blender are different types of windows ie. 3D View and File Browser are two different types of editors.

    Editors can be split or joined by RMB click on the edge of the editor.

  • stackexchange > close / open editor

Setting up units and scene measurements

Selecting Objects in Blender

To select an object in Blender, be in Object Mode and LMB the object.

To deselect the currently selected object LMB click on a new object.

To add to a selection LMB while holding shift and, likewise a selected object can be deselected while clicking LMB + shift

Working with Object Pivot Points

Snapping in Blender

Working with rulers

Working with rulers in Blender 2.79 is quite limited IMHO, because after a ruler is created the starting and ending point can not be relocated / edited.

To delete a ruler they can be located in the Grease Pencil drop down in the Properties n of the 3D View.

Working with the Grid

The visibility of Grid Floor can be toggled from within the Properties panel n of the 3D View.

Working with Object Colors

To assign a specific color to an object in Blender to easily distinguish between different objects in a 3D View Editor

  1. Open a Properties Editor
  2. Select the Material Type button / graphic
  3. Create a new material, and adjust color of the material using the sphere.
  4. Select an object in the scene and then apply the newly created material to the object.

Cura 4.x > Working with Cura

  • TODO add notes about backing up cura settings when upgrading

  • see the following link for app directory paths containing files that can and should be backed up between cura upgrades.

Cura > Settings

❗️ The below settings are highly opinionated ...you've been warned

Cura > Settings > Retraction
  • A common retraction setting for cura is 6mm @ 60mm/s
  • An optimized retraction setting is 6mm @ 25mm/s thanks
Cura > Settings > Built Plate Adhesion > Raft
  • A suggested setting for rafts are
    • air gap 0.2
    • top layer thickness 0.12 same as material layer height setting
    • middle thickness 0.16

3D Printing

  • a nickel coated copper nozzle can reach temperatures required to print poly carbonate based filaments.

Working with Octoprint

To manually install Octoprint see the official octoprint guide

3D Printing > Objects > Nuts and Bolts

3D Printing > Objects > Benchmarking

thingiverse > first layer testing

3D Printing > Creality > CR-10S Pro

creality3d.cn > Official Homepage

the above link provides files for both the lcd and firmware

  • The version of the CR-10s pro I have comes with a v2.4.1 motherboard

The CR 10S Pro has a magic number of 0.04 as most if not all Creality printers have a magic number of 0.04 This number refers to the layer height of a print. The layer height is determined by the stepper motors for the printer and does not refer to the micro stepping of the stepper motors. There is a great video of this magic number correlating to the stepper motors.

3D Printing > Creality > CR-10S Pro > Upgrades

❗️ the info in this section is gunna be, kindof random for the time being, as it's a transcribe of notes I've been making for doing various upgrades to a CR-10S Pro, circa August 2019

  • The most common connectors found on the logic board for the CR-10S Pro are JST
    • JST connectors come in a variety of pin outs and pin arrangements, however a standard 0.1"22AWG jumper can be connected to any pin out on the logic board.
    • To the best of my knowledge the spacing for the various JST connectors on the logic board are 1.25mm
  • The 30pin ribbon cable that comes with the printer is ~ 4 feet 3 inches in length and has ten unique colors on the cable that start with brown and end with black.
  • A 22AWG jumper wire should supply enough amperage for every current version of a rpi as it can provide a steady 3A in a chassis configuration, ie. under 1ft wire length.
  • the 30pin ribbon cable uses what I believe to be a IDC connecter on both ends for termination and it appears the pitch of the pins is ~ 2.54mm ie. 0.1 inch.

    the pitch is measured from the center of a pin to the center of a parallel pin.

    • TODO uncertain of the AWG for the wire used in the 30pin cable.
  • ❗️ MOST if not all electronics powered from the 30pin ribbon cable are polarity dependent, ie. the hot end fan JST connectors must be plugged in a certain way, ie. black wire negative has to be plugged in to the negative output from the logic board.
Supplies
  • clear heat shrink tube / tubing can also be referred to as natural.
  • AWG refers to wire pitch / gauge
  • purchased soundoriginal 12V blower 5015 fan from amz where the red 28AWG wire is positive and the black is negative.

UsefulLinks

TODOs

  • Marlin show current layer # of the layer being printed
  • Marlin ring bell / speaker when hotend or heat bed gets to set temperature
  • Blender add note about preserving scale when exporting stl and importing stl into cura
  • Blender make quick little cast / video about different orbiting methods in blender
  • review useful links
Clone this wiki locally