GIMP and dithering color reductions for B/W “portraits”

The many faces of Rocco: in my 2013 tests in Gimp, the image is 150 pixels wide by 154 pixels high  The image is used with the kind permission of Rocco’s owner. I have used this image before, when I posted previously on some ways to reduce colored images to B/W for possible knitting using a Mac computer, please see post on 013/03/14/ color-reduction- conversions-mac-os/. Gimp offers some alternatives to the familiar dithers and is available, free, for both PC and Mac platforms. Tutorial links on Gimp edge detection available online as of May 2019 are listed at bottom of the post.

Image_Mode_Indexed_ one bit black: immediate result, too dark

Threshold adjustments may not be made in indexed images to alter the above image, so it’s back to greyscale. Reductions to greyscale may be achieved through Image_ Mode_ Greyscale or choosing Colors_Desaturate_OK options. Desaturation offers additional choices

Image_Mode_GreyscaleColors_Desaturate_OKRocco desaturated, in “knittable portrait size”using edge detection and its algorithmsDifference of Gaussians

what happens if in addition color_ invert is used with Robertsadjusting B/W with Thresholdafter a bit of “tweaking” Image_Mode_Indexed, rendering it “knittable in 2 colors” getting silly with filling the ground with pattern behind the floating head

2021: the latest, December 2020 updated version of Gimp for Mac OS
Gimp dithering controls easily accessible with mode changes to indexed I found I got the best results adjusting the contrast in the original greyscale image prior to changing its mode to indexed and dithering (Floyd_Steinberg, normal)  Dithering options in Gimp 2.10 may be found at the bottom of the colors menu or when converting to indexed colors, here to black and white, the image unaltered, using positioned dithering, the last option  Hyperdither: options offered  default Jarvis
default Stucki
online, options https://ditherit.com it is possible to choose from multiple palettes Sierra dither

5/4/2019 Other than GIMP: after straightforward load, convert, save, with no other adjustments, images shown in approximate 150 pixels/sts in width, no significant change results with conversion to color B/W indexed
http://gazs.github.io/canvas-atkinson-dither/
online, default settings https://29a.ch/2016/08/04/ditherlicious-1-bit-image-dithering
Check dithered results, downloaded images may be in RGB Mode. Prior to any knitting, they will need to be converted to B/W indexed.
Looking for ways to reduce the noise in dithered images I tried this conversion in XnSketch, using the photocopy effect,  beginning with the colored image of Rocco, the results: imported the result into Gimp and saved it in indexed  2 color BW and in turn, 3 color indexed mode, no color adjustments, finding the result pleasantly simple beginning with the greyscale generated image followed by Mode changes in Gimp, indexed 2 color BW, then indexed 3 color, there appear to be very subtle differences with a bit more detail: Another online resource with an extensive array of dithering options https://app.dithermark.com. Here are 2 conversions using the app, the images are 2 color B/W. The presence of a third color is an illusion created by the difference in the distribution of BW color pixels, they loaded fine as viewed for knitting in Ayab, and in img2track, once I remembered to change its setting to 2 color knitting from the last used one at 4 colors It is possible to reduce images to 4 or 3 colors using the program as well: a slider for color count is used to choose the final number of colors in the reduction. Again, these instances have no added manipulation A series of dithers:
To retain the quality and size of the dithered image, download it, rather than using a screen grab. The software used to separate the chosen dither may alter the result somewhat. I am writing my posts using an iMac M1 with OS 12.0.1. At this point Ayab is not operable, img2track does open images, but in this case, with interesting distortions, and it does not download any files at all. Yet another dithering tool, allows one to draw in dithering mode using a variety of patterns and will dither images. In the latter instance, there is no real opportunity to tweak or alter the result shapes drawn using a few of the large variety of offered patterns: 

 

More GIMP charting 3

These are quick notes from some of my continuing experiments, not explicit how-tos or item patterns. Possible lengthening of designs dependent upon knitting technique is not considered; the “charts” were created keeping the aspect ratio of the original motif. The initial images are copyright free.

from scanned B/W source, 200 pixels X 227

open document

Image_Mode_B&W 1 bit indexed_ Convert

Image Scale 200 wide down to 50

areas were “cleaned up” using single-pixel pencil, when satisfactory capture window with grid enlarged for working graph,  or remove the grid, export in format for download

this is a partial repeat of a large black and white .png image

working with a smaller, random selection

Open image

Image_Mode_B&W 1 bit indexed_ Convert

enlarge, show grid, decide on the accuracy of repeat,  when OK, graph or export and knit, no clean up required for this one

Filter_Map_Tile_magnifying result  will test the accuracy of the repeat

the motif was a random crop, with obvious issues, more work would need to be done with the original image to isolate the proper section for tiling accuracy to occur

a multicolor image 143 pixels X 112

Image_Mode_Indexed _3 color (manual change from 4 to 3)

Image scale to 100 pixels wide

Enlarge for viewing grid and/or cleaning up; result yields 2 repeats that could be used 50 sts wide each, leaves could use a bit more detail

a partial image grab, pre any “corrections”

if color separations are needed for software that can superimpose colors and do the necessary color changer manipulations cues a link on color separations for screen printing provides some ideas. Another method

Tools_Selection Tools_By Color Select

Edit_Copy

Create new document the same dimensions

Edit_Paste

repeat for each color

the results: the flower is actually in the “wrong place” even with what appeared to be the same document settings

easier and “on the spot”:

Tools_Selection Tools_By Color Select

Click on color one (flower)

Edit_Cut

Fuzzy select, click on the screen outside of the image: the result

Re-open original image

Tools_Selection Tools_By Color Select

Click on color two (leaves)

Edit _ Cut

Fuzzy select, click on the screen outside of the image: the result

 

 

 

 

 

 

GIMP software 2

This is the method I used to achieve the “color separations” in the previous post:

File new: create in canvas size for a knit repeat: deleting the default 0 gives a working surface that is 64X40/ OK for small motifs

Change magnification to 1,000, hit return

GIMP Windows_Dockable items_ navigation will provide an easy slider to adjust sizing as needed

View: show grid, snap to grid

RGB mode

Draw test motif repeat, using the one-pixel pencil tool in B to draw, W to erase

The program allows for combining all items in one window, I prefer not to

test motif

Save the file in native format .xcf  for backup and future changes

Use color markings to outline repeat

Adjust magnification with navigation slider if needed for easier editing

With crop tool, crop area within colored markings; menu_image_crop to selection

Use filter, map tile to view repeat in multiples- adding a 0 to both x and y pixel number values is an easy way to achieve that. The tiled image is in turn easily gridded if such a graph is required- simply go to view, highlight show grid, grab the resulting image, and save

If the repeat is satisfactory: back to image cropped screen, click within the window, go to file export menu, choose the file format, and save as png, BMP, etc for download, or simply screen grab the image in an easy to see size if punching a card or requiring a single repeat chart. I do not own Dak; GIMP does have a .pat read and save, but I have no way of testing whether files are in any way compatible between the 2 programs.

Most electronics are able to take the motif repeat and separate it automatically for a 2 color DBJ knit. If a separation for 2 colors DBJ is required for use with a punchcard, or for any of the fabrics already discussed one needs to return to the .xcf magnified document.

For the simplest DBJ separation, each row will break down into 2 colors, which in turn need to be knit with 2 passes for each color. This method is the one that is most likely to increase the lengthening of the knit image, but one that “always” works.

To lengthen the repeat X2, cropped repeat area needs to be converted to 2 colors or  go to image, mode, click on convert

Gimp 2.8.22: Image, mode, select Indexed 

Open Image Scale window; use image scale tool, clicking once again on selected repeat areaGIMP 2.8.22: highlight number you wish to keep constant

To break the aspect ratio and control one of the 2 values, click on the chain like symbol on right, it will appear “broken”

change the second value

Click on scale image. If the intent is to continue editing by using the pencil tool, the image mode needs to be returned to RGB before proceeding with editing.

Adjust numbers to the desired scaling, height doubled for the original repeat would be 18 pixels in length, here is the result

To separate the rows revert to RGB mode, unselect repeat area by clicking outside its parameters.

row 1/color 1 in DBJ needs to knit in the largest number of “squares”, so my color inversion will begin on design row 2, for color 2; because these are individual pixels, numbering is not possible; I use color guides for the row that need to be inverted and repeat outline, and use the navigation bar to enlarge for easy selection individual rows with the crop tool

After selecting the desired row with the rectangle select tool go to colors_invert, seen here for the first row of color 2, repeat for the length of motif. The result is suitable for use with double length KM built-in features and using the color changer. The black squares represent programmed pixels in download, or what is drawn on mylar/ punched in the card.

If the double length of the separation is required: image _mode _indexed removes red and yellow squares, repeat process described above: select motif, use scale tool over the same area, scale image to 8X36. The caveat here is that one needs to be in the original canvas area: with a beginning canvas that was 64 X40, there is enough room for doubling length once more. Undo scale, use scale tool again, dragging upper and lower corners, keeping an eye on changing numbers in the window for scale tool, type correction to numbers if needed, click on scale,  autocrop to selection for export in the desired format or screen grab and print to the desired size

working with more colors, toward similar goals

adding colors: 3 colors per row motif, drawn in RGB mode

to make it the required triple length

resulting image when scaled to triple pixel height

the still manual color separation: whiting out unwanted colors in each row

double the length again

colored squares represent pixels in download, square in mylar, punched holes in the card

GIMP software 1

GIMP (GNU Image Manipulation Program) is an image retouching and editing program released as free and open-source software. There now is a Mac OS Mountain Lion compatible version. The downloads may be found here, and more links for features, supported file formats, help tutorials. One limitation is that for “color separations” to work by inverting colors one needs to reduce images to 1 bit B/W images, a definite advantage is the speed relative to working in spreadsheet programs. Another drawback is that one is using single-pixel designing, so adding numbers for rows and stitches in a particular format is not possible. My June 10th post on illusion knits illustrated an example in creating repeats for them, here are sample results/charts

quilting double bed (for more on the topic see May 30th post)

MOSAIC PATTERNS

the accompanying swatch, which shows the difference in width resulting from using tuck setting <—> (top) and  slip <—> setting (bottom)
double jacquard

images of working settings and gimp windows for my separations

Illusion /shadow knitting DIY designs_HK

I have played with excel (and Numbers) before to create charts for various fabrics requiring color separations. My latest efforts relating to this knit group have gone in a different direction; I have also attempted to simplify the technique in terms of following the instructions for knitting them. This sample began with the use of Intwined to create the document and graphs. The first chart is set up with alternate row color striping, color 1=dark, color 2 = light. Blank-colored squares are used as knit symbols, horizontal dash for the symbol for purl stitches. Beginning on light-colored, even-numbered rows, the design is marked in purl stitches. On odd-numbered rows beginning with row 1, mark all empty squares in the even-numbered light-colored row immediately above it with purl symbols. All unmarked stitches throughout the design are knit, whether, on the “wrong/right” sides, all dashes are purled, patterning occurs on the second row of each color. To visualize the full pattern one may use the add row below feature to expand the graph (the chart below is missing the very first row). Now add the second row of each color and grounding stripe (s) at bottom of the repeat. Most patterns will start the illusion immediately after casting on with dark color, row 1 above. I was interested in my sample having a border of sorts on its top and bottom. The resulting knit swatch shadow sideIntwinded had the capacity for building row by row written instructions for patterns, but there were discrepancies on some rows for these charts, and I opted not to include them.
Note: the program quickly became buggy, unsupported, and unusable on the Mac during the remainder of 2013.

Another program I have just acquired and begun to use is GIMP; it is free, and now also available for use in Mac OS Mountain Lion. Both Gimp and Photoshop make it possible to design using single-pixel pencil and grids to build motifs from scratch as well as gridding of preexisting images. I have a different method for these fabrics using GIMP, easier for more complex, overall shapes. The same series of steps may be used for mosaic knitting (the color inversion sequence is different). Below are images generated for a different illusion pattern, I will share my “how-to” for designing the motifs later, referencing mosaics and mazes. To achieve such motifs one is drawing in magnification of multiple hundreds and more, there is no way to number within a one-pixel space, so these charts as generated are lacking numbers for stitches and rows, one drawback. Another is that this color inversion works only in black and white. One advantage: the proper repeat may be cropped and saved with grid removed in a variety of formats that may be used to import to various machine knitting download programs, and gridded may be used to establish punchcards or mylar repeats.  Screengrabs of magnified charts were saved, and are shown below. Black squares represent purl stitches in the second row of each color. The first row of each color is always knit, not represented in these charts
The red squares are guidelines for no color inversion rows, the yellow ones isolate the repeat the actual repeat color inversion begins on row 1 and follows every other row (if numbered these would be odd rows)  testing the repeat through filter/ map/ tile a working chart that can be printed to suit with dark/light row markings and blank squares for tracking knitting rows in the execution of the pattern A larger version with stitch and row counts marked. The chart represents half the rows in the actual knit. The cast on row counts as knit row 1, color 1, and following the chart beginning with row 2 knit the black squares and purl the white squares. *Change color, knit one row (odd#), on the next row follow the chart, knitting the black squares and purling the white (even#).** Repeat from * to **. the knit swatch: “shadow side” its reverse side for online tutorials, patterns, and inspiration see Woolly Thoughts

Feb 18, 2017, I have recently become curious about creating illusions such as these in crochet, am developing ideas, and returned to this chart. The image below is intended to have symbols and notes superimposed on it. It shows the tiling in a different way, so I thought I would add it to this post as well. Repeats are highlighted with darker borders. The repeat on right needs to be trimmed if the goal is to achieve matching edges. Row counts on right would differ in knitting, the plan is to execute this pattern in Tunisian crochet, which handles rows in a very different manner than knitting or standard crochet.Follow up: 2017/03/06/illusion-DIY-patterns-in-crochet/

2/2019 from the first in a series of posts on geometric shapes on ribber fabrics using tuck settings, a mock variation with the ribber set for knitting in both directions throughout, and the main bed set to tuck in both directions:

Color reduction/conversions, Mac Os

A recent forum post brought up the question that rises periodically on how to reduce colors in photographs, scans, etc. so as to be able to in turn use the image in a low-resolution medium such as knit. There are very many ways to achieve this. The post had specifically asked for low cost or free alternatives using Mac software, so I began playing, and compiled the following document detailing some of my processes, addressing large scale, non-repetitive images in Color reductions for knitting. The document samples were simple, straightforward conversions, with no further “tweaking”.

Mac Os: iPhoto, Preview, further software downloads:

Free:  img2trak, HyperDither, XnConvert

99 cents One bit Camera
an option for Mac users, Bitcam

Free to try, $39.95 to buy GraphicConverter, the developer site
diffusion, halftone, pattern, custom A tutorial for owners of Photoshop   diffusion, halftone, pattern, custom With thanks to my test subjects: RoccoOne bit camera and my sofa fabric

An online service that will do the conversion for you: Knitpro, and a free service GitHub May 2019: ditherlicious

A later post on the topic, showing the many faces of Rocco

Knit QR codes 1, repeats from BW images

A video on this topic. I work using Mac OS 10.10 at the moment. When I first wrote on this topic, I downloaded a then free converter The app, Aztec Code Generator, is now no longer free (11/2015) but costs $ 1.99 to purchase. There is a still free, online QR generator

my beginning code

the original image size was reduced to 60 pixels square, and in turn to 40 pixels square respectively, then magnified to 600 times for superimposing the single stitch grid as described in the video; screen-captured image saves are needed for saving gridded images

the 60 stitch repeat

the 40 stitch repeat

using the Aztec code generator to control output size

Screen Shot 2015-11-13 at 9.30.23 AM

saved

Untitled

X1,000, cropped and gridded

screenshot_43

not all units are created equal: areas numbered indicate where some of the horizontal units are 5 wide rather than as most 4, and closer inspection will reveal the same for some vertical units. Reconfiguring the grid ie to 4X4 pixels would be an alternative way to “resize” the image, but fails because of the disparities when the unit is applied overallscreenshot_43

trying the same process on this BW jpeg, the resulting repeats require further cleanup and editing along edges of shapes

using GIMP: 40 stitch repeat, no additional scaling, converted to 1bit BW, could use a bit of clean up, I prefer to work with a black grid

40s scroll

24 stitch24s scroll

as an afterthought: results using img2track to pixelate the same image before gridding

please note these scroll graphs are not accurate working repeats to be knit as they are

it is always a good idea to test tiling for any “surprises” before any actual knittingscreenshot_41

11/2015_Knitting’ low resolution is reflected in the number of stitches and rows per inch or per repeat. In this instance, Gimp was again used to scale and process the image

Today’s generated image: happy holidays QR code, Aztec code generator, 300 pixels square including white border

happy holidayscolor mode converted to 1-bit B&W; 100 stitch repeat

&H100

scaling, gridding for 30 stitch repeat

HH30st

for 24 stitch repeat: note loss of detail as stitch and row counts are reduced

h&h24

and happy holidays via the free, online generator static_qr_code_without_logousing the generator options to control available output size

QR generator

The above begs many questions. Upon investigation, it appears there are 18 2D bar code variants, some static, some dynamic. Qrme is a UK site that provides information on trackable QR codes, forums, and more. Their page shows scaled in size codes modules.

HK pattern, software charting.

I have reached the point where decades old (89 and earlier) magazines that got “saved” are now being peeked at, and if not given away, then recycled. There may be some bleed through here from pages I have “saved” once again. Browsing through I found some designs not appropriate for machine knitting for one reason or another, but still creating interesting surfaces and the chance to explore using intwined’s other features. The program will create text from a chart, or chart from typed text with some limitations. One of the latter is a very large cable as seen in the attached document. PDF exports can happen within the program if one is specific in the sequencing of creating its documents. The 1989 pattern had only text for the repeat; I typed it, and had the chart pretty much created for me except for the problem row 5. Here is the resulting Intwined created PDF with some of my comments: cable_diamond. The following is the graph I edited, with my illustration for the execution of row 5

the blue line separates the slip stitch section, which can serve as a border on each side of the cable panels, the red lines the edges of the 12 stitches involved in the cable. The green stitches are put on a cable needle and brought to the front of the work, the next 6 stitches are knit first, then the ones from the cable needle to complete the crossing.

the swatch: knit side

the purl side

Hand to machine knitting, symbols 1

One of the critical differences in viewing work as it progresses on the knitting machine is that the “front” view of the fabric unless the work is removed from the needles through a variety of techniques and turned over on the needle bed, is the purl side. Early machine manufacturer punchcard book publications made an effort to help hand knitters make the transition. A chart from brother publishing knit_sym96 illustrates one such effort. Here the middle icon in the how to work column is the stitch formation one would need to achieve on the MK to get the same “look” as the HK samples. Some symbols apply to both types of knitting, some should be mirrored horizontally to make sense, and in the case of the crossing stitches at the top right of the second column, there is a bit of confused identity.

Over the years there has been an interesting transition from handwritten stitch by stitch instructions to the introduction of symbols ranging from homegrown on graph paper, to simple word processing and later software generated ones. Some international differences occurred in published works, and internationally agreed-upon symbols for both knit and crochet eventually evolved. There are many design programs on the market now, I have linked to some in past posts. As knitters have venues for publishing their own repeats and patterns and tools have multiplied, symbols do not always necessarily have the same meaning, and stitch codes are no longer universal.

I have been wanting to find a way other than using excel to build a stitch library usable for machine knitters in an easily accessible program that would do some of the “work” for me. I have experimented with 2 programs. One was knitbird, which I would not recommend for this purpose, the other Intwined Studio which is proving far more flexible and worth the modest investment for me. I work on MacOS10.8, the Intwined version for this OS is beta. There are some small glitches, but this is a tool worth exploring. The option is there to add one’s own symbols to the stitch library. I have begun working on a machine knitting set with icons created in a combination of other programs and Inkscape, the one suggested in the tutorial by the developer. Some charts created with Intwined may be seen in my previous post on sideways pleated skirts. Below is a chart including some MK symbols in my personal library, also using the option to the color background for them in the program itself rather than editing the chart image after the fact.

To download Inkscape: site. The workaround to get the program to work in Mac OS10.8 may be found here.

The combination of color with symbols in published patterns for both hand-knit and crochet is beginning to proliferate. I find the visual color cues help track patterns more easily, have done it in HK in the past, one such example is my chain cable experiment in my January 3rd post.

Some illustrations for lace symbols HK vs MK may be found in my post from February 25, 2012 “back to lace”.

My latest shawl

Still working on lace pieces, sorting out the differences and issues in this knit fabric type. My shawls are one-of-a-kind or limited edition items. The fiber content and finished sizes vary.

This is the repeat as it may appear in a hand-knit lace graph. Not enough symbols in Knitbird, the design was achieved by using the Aire River knitting font, and applying appropriate symbols to an excel grid

border transition detail shot

the shawl