A New Chart Making Program. Update 21 Feb 2018

For all topics which do not fit in the other categories.

Moderators: rcperryls, Rose, karen4bells, Serinde, Alex

Post Reply
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

A New Chart Making Program. Update 21 Feb 2018

Post by richardandtracy »

I do hope I'm not out of order promoting my own stuff... It is, however, a freebie!

Three years ago I started using the 'Ryijy Stitch Designer' Chart making program, but found that at the time, the program would only print the chart on one page. So, rather than grumble, I wrote a program to print out the chart on several pages once the image had been converted to DMC colours. And sent the source code off to the programmer of Ryijy when he asked how to do it. In the intervening 3 years I have tinkered with the program off & on and last week decided to try to see if I could crack the colour conversion from ordinary images to DMC colours. As it happened, the answer was yes.

So, can I offer for general consumption a new, free, chart generation program. It's available from my signature, and a download on this page of my website: http://www.chestnutpens.co.uk/misc/crossstitchplan.html

The program window looks like this:
Image

If you load in an image with non-DMC colours, it will automatically open a window that will allow you to have input into the conversion of colours:
Image

Then you can create back stitches over the chart image:
Image

Or, uniquely, back stitches can be drawn over a high resolution image so that full detail can be seen. The chart image can be scaled and re-positioned over the high res image so that the stitches can be in the perfect position:
Image

There is also an image editor:
Image

I do hope it's useful to people other than myself! If you find any bugs (apart from an elastic banding re-draw issue in the standard back stitch drawing window that I know about and will try to fix), please let me know.

The colour conversion routine allows a huge amount of control - however the corollary of that is that there are millions of ways to get a horrible picture! You will need to experiment, and I can't offer much experience to guide you, having only come up with this bit of the program towards the end of last week.

Regards,

Richard
Last edited by richardandtracy on Wed Feb 21, 2018 8:23 pm, edited 29 times in total.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
Allyn
Posts: 2226
Joined: Sat Mar 30, 2013 4:57 pm
Location: Mississippi Gulf Coast
Contact:

Re: A New, Free, Chart Making Program

Post by Allyn »

Thanks, Richard. I downloaded it. I have a 64-bit Vista system so we'll see how it works for me. :)
_________________________________________________________

WIP
Image
User avatar
NeedleAndFork
Posts: 980
Joined: Tue Apr 09, 2013 5:05 am

Re: A New, Free, Chart Making Program

Post by NeedleAndFork »

Very cool I haven't downloaded it yet, but you can be sure I will. I've been selling a few patterns that I converted over from images for a while now. heck, giving them away more like it, but I'm still not completely happy with the software I'm using. I'll be glad to try yours out and hope for better results! If the images you've shown us so far of your own stitching are proof of how it works, I'm pretty optimistic!
My blog: Obsessed With Thread

My WIPs: Kimono Lantern Mermaid, Rovaris Alphabet Sampler Christmas Ornaments

Participant of: Ornament a Month SAL, Stitch from Stash Challenge
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

I forgot to mention a couple of limitations to the program, and it would be a good idea to state them now.
  1. The graphics import is limited to windows .bmp format - though you can paste images into the program from clipboard to get around this limitation. The reason is that the software libraries I'm using date to 1997 when .jpg/.png were not so common and .gif was an internet only format... OK, OK, I know I'm using severely out of date software, but it has taken me around 14 years to get used to the libraries & teach myself enough to get this far. Going to new software would mean ditching every last library tool & vestige of knowledge I have & starting from scratch again. I'd rather go on to the bitter end and get what is 'Modern' when I really have to change.
  2. There is no re-sizing or cropping of the image possible in the program. I have yet to look into that idea. It's another concept that looks very simple but is probably very much more complicated when it comes down to it.
  3. At the moment there is a limitation of 100 symbols/colours in the printout. I can increase this if need be - but will have to think long and hard about symbols that will be clear enough to read and not confuse with others at 10 to the inch - I thought I exhausted the list at 100!
Also, I am open to suggestions. If you think the program would benefit from any idea (say, the ability to change fonts in the chart from the current clear but technical 'Arial', or to sort the thread numbers by DMC number rather than stitch number - I prefer this sorting method but it may not suit everyone) then let me know & I'll see what is possible.
I have to say right now - to rule out one option - that I do not think that a print preview is possible. I have investigated it and found that to do it sensibly the program would have to draw the entire document in a window, and the document could end up with hundreds of pages. When I tried to do it, the size of the preview image caused my PC to have hysterics, and it's the only time I've managed to crash Windows 7. The way to obtain a 'Preview' is to print to a PDF printer rather than a physical one. That gives you the choice then of e-mailing the chart or printing it from Acrobat Reader. Full chart document pdf sizes are not small - the one for my next project (450 x 312 stitches) is 59 pages & 7.9Mb.

Regards,

Richard
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
NeedleAndFork
Posts: 980
Joined: Tue Apr 09, 2013 5:05 am

Re: A New, Free, Chart Making Program

Post by NeedleAndFork »

richardandtracy wrote: Also, I am open to suggestions. If you think the program would benefit from any idea (say, the ability to change fonts in the chart from the current clear but technical 'Arial',
Since you mentioned fonts, and Arial specifically, not that it makes that much difference, but a very similar looking font that I think has a slightly cleaner look is Helvetica. I've always thought it read better in a small size, mainly because its kerning (spacing between individual letters) is a bit better done. But that's such a small detail that only font geeks like myself would notice. :) Most people can't even tell the two fonts apart.
My blog: Obsessed With Thread

My WIPs: Kimono Lantern Mermaid, Rovaris Alphabet Sampler Christmas Ornaments

Participant of: Ornament a Month SAL, Stitch from Stash Challenge
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

Helvetica is not a standard Windows font, so it would be dangerous to hard program it in. It could be given as an option in a font drop down list that's filled in for each machine, though. I'll look at the implications of this.

I'm currently seeing what I can do with an image scaling routine. The results are 'Interesting' to say the least. At scale factors of 0.25/0.5/0.75 it works perfectly. At intermediate scale factors, the results are somewhat random. I need the programming equivalent of DDT and a bit of time...

Regards,

Richard.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
NeedleAndFork
Posts: 980
Joined: Tue Apr 09, 2013 5:05 am

Re: A New, Free, Chart Making Program

Post by NeedleAndFork »

Ah.. in that case don't worry about it. the two are so close anyways. I forget sometimes that there are people who don't have several hundred extra fonts beyond the basics that come standard. I got hooked on fonts in college as a graphic design major and always have had extra font packs installed as a result. I don't think the extra work of giving people the option to choose from a drop down would be worth the hassle for such a subtle difference.
My blog: Obsessed With Thread

My WIPs: Kimono Lantern Mermaid, Rovaris Alphabet Sampler Christmas Ornaments

Participant of: Ornament a Month SAL, Stitch from Stash Challenge
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

Bug killer worked. Now I know how to scale images down.
Need to fit that knowledge into the chart program now.

Regards.

Richard.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
NeedleAndFork
Posts: 980
Joined: Tue Apr 09, 2013 5:05 am

Re: A New, Free, Chart Making Program

Post by NeedleAndFork »

Awesome. I still haven't downloaded - will do over the weekend when I have the time to play with it uninterrupted. Quick question.. how well does it handle the dithering over gradients? That's where I'm running into problems with every commercial program I've tried. Either they just give me bands of colors that form odd stripes, or very distinct patterns of alternating colors like a checkerboard, neither of which I'm happy with. I end up dropping my image into photoshop and adding a bit of texture to the background and smudging it around a bit to try to counteract that, and it works in background areas, but isn't necessarily something I want to do on an area that's the focus of the image.
My blog: Obsessed With Thread

My WIPs: Kimono Lantern Mermaid, Rovaris Alphabet Sampler Christmas Ornaments

Participant of: Ornament a Month SAL, Stitch from Stash Challenge
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

How does it handle 'Dithering of Gradients'?

The time honoured way: By refusing to believe the problem exists.

I know why there are problems with gradients, and I'm not a capable enough programmer to get around it (and from the evidence of other programs, neither are many other programmers, [good to know I'm not alone in my inability!]).
The way my program works, and from seeing the results from PCStitch10 and Ryijy, I'm sure it's the way most other conversion program works, is to go through the image pixel by pixel finding the best thread match for that pixel. That way you always get the same colour out whether it's a single pixel or in a gradient. To know that dithering is needed implies that the program needs to take into account - somehow - the surrounding pixels. Basically an algorithm would need to be developed to do the following:
  1. Recognise a gradient boundary.
  2. Recognise the extent of the boundary.
  3. Identify the direction of the gradient.
  4. Identify the depth over which the gradient is to be applied.
  5. Create an appropriate dithering pattern.
  6. Apply the pattern
Just listing the steps out like that means it's part way to being solved, as programming seems to me to be little more than breaking down the process into small enough steps that can then be expressed very simply, but nonetheless step 1 is not an insignificant problem.

How much input would you be prepared to put in? Have it all automatic? Or be prepared to do the pattern recognition bit that humans are so good at and identify and lasso the area of the gradient, mark one edge of the lassoed area as one colour, mark the median line, and the other side as the other colour and leave the computer to do the grunt work of the dither? That would mean the difficult programming of 1-4 would be un-necessary and the effort could be concentrated on creating a dither based on three [probably] curved lines.

Just a thought.

Regards,

Richard.


PS. I have just realised what I have suggested, and even 5 & 6 are possibly at or beyond the limit of what I can imagine implementing.

Edited to add:
I have looked up Floyd-Steinberg dithering ( http://en.wikipedia.org/wiki/Floyd%E2%8 ... _dithering ) and it looks to be a possibility to experiment with, but not incorporate without further trials.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

I have incorporated font selection for the chart. Proved to be less of an issue than I thought. Font selection is also saved in the project file.

The Detailed Key & Fabric Details use the same font at a point size 2 bigger than the chart font. The Index Page font is the same as the chart font, the size is the larger of 12 point or the Image Copyright font size on the front sheet. This is hard coded at the moment. Give people too many options & they don't know what to choose... :lol:

I have not uploaded the revised program yet - will incorporate scaling first & see if dithering is possible too.

Regards,

Richard.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
NeedleAndFork
Posts: 980
Joined: Tue Apr 09, 2013 5:05 am

Re: A New, Free, Chart Making Program

Post by NeedleAndFork »

richardandtracy wrote: Edited to add:
I have looked up Floyd-Steinberg dithering ( http://en.wikipedia.org/wiki/Floyd%E2%8 ... _dithering ) and it looks to be a possibility to experiment with, but not incorporate without further trials.
The program I use has a few options.. I think Floyd Steinberg is one. I've tried switching between all the options and am not too thrilled with any of them. They all look too 'perfect' with evenly spaced Admitedly, the problem is most visible when I've got a very smooth gradient on a high res image - the math in whatever formula is used would work out in even grids alternating between the two colors then. I think maybe this is where some of the art in creating patterns comes in to play, with needing to spend time manipulating the image before dropping it into a program to maintain the integrity of the image while still getting a good pattern. I haven't experimented enough with that side of things yet, so maybe I'll go at it from that angle.
My blog: Obsessed With Thread

My WIPs: Kimono Lantern Mermaid, Rovaris Alphabet Sampler Christmas Ornaments

Participant of: Ornament a Month SAL, Stitch from Stash Challenge
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

OK. I have tried a number of different dithering methods. The image I have used is one I know to be 'very difficult' to convert, and causes the most problems for conversion routines of any image I know. As it's a face, humans register image problems more strongly than almost any other image type - so if the image can look 'OK' or even 'Pretty good', then it'll almost certainly work well for other images. All the files are at a 'stitchable' size (200 x 143) so may need to be copied & zoomed in to in order to see the dithering

Original Image
Image

No dithering, straight least squares RGB conversion (traditional method for many conversion programs). In all honesty, the conversion of this image is pretty horrible:
Image

Leaving all other parts of the conversion alone and adding in dithering only, these are the results with different dithering methods:
Floyd-Steinberg dithering:
Image

Jarvis et al dithering:
Image

Stuki Dithering:
Image

Burkes Dithering:
Image

Sierra Dithering:
Image

Sierra 2-4a dithering:
Image


Out of interest, I grabbed an error enhanced intermediate image from the Floyd-Steinberg process and that's as below:
Image
It's strange how the colours are all slightly over-enhanced.

None of the images are perfect, but all are greatly better than the starting point least squares conversion. The Sierra 2-4a (one of the simplest) is good for this image, and the Jarvis (most complex) seems to be the worst, but may not be the same for all images.

Unfortunately all the computerised processing methods will tend to come up with fairly regular dithering - it's the nature of the beast. If you are repeating the same process over & over, the results will probably look a bit as if they have been repeated over & over.

Regards,

Richard.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
mags
Posts: 10436
Joined: Fri Apr 06, 2007 11:47 am
Location: UK

Re: A New, Free, Chart Making Program

Post by mags »

Thanks Richard, I am following this with great interest ( not that I understand all the terminology :lol: )
mags

WIPs:
Heritage Tower Bridge (yes still :roll: )
various bits and bobs
User avatar
NeedleAndFork
Posts: 980
Joined: Tue Apr 09, 2013 5:05 am

Re: A New, Free, Chart Making Program

Post by NeedleAndFork »

richardandtracy wrote: Image
It's strange how the colours are all slightly over-enhanced.
Is this an image from conversion to pattern, or just an altered original image? Because if it's a pattern, I think it looks pretty damn good actually. Her skin actually has texture that looks like real skin, rather than a digitized repeating pattern which is inherent in the dithering process.

The more I actually think about it based on our discussion here, the more I realize that to get a truly good conversion, there will need to be some photoshop involved. That's what sets a so so pattern conversion that comes up with just anyone drops a photo into the software apart from a great pattern that has been tweaked prepared for conversion so that the conversion software is just one tool in a personals arsenal of tricks to come up with a finished product.

That said, I'll download what you've got so far and try sticking in an image that was giving me trouble and see what happens, and post results comparing it to what I got with a straight out the box conversion and a photoshop enhanced conversion. Should be interesting to see what happens.
My blog: Obsessed With Thread

My WIPs: Kimono Lantern Mermaid, Rovaris Alphabet Sampler Christmas Ornaments

Participant of: Ornament a Month SAL, Stitch from Stash Challenge
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

NeedleAndFork wrote:
richardandtracy wrote: Image
It's strange how the colours are all slightly over-enhanced.
Is this an image from conversion to pattern, or just an altered original image? ...
...
That said, I'll download what you've got so far and try sticking in an image that was giving me trouble and see what happens, and post results comparing it to what I got with a straight out the box conversion and a photoshop enhanced conversion. Should be interesting to see what happens.
The image is the original image + the error corrections used in the dithering to force the dither colours to change. Unfortunately it is not a DMC compatible conversion - I wish it were.

Please remember - I have not yet uploaded the revised program, so the current one has no dithering. The chart making program is getting pretty complex (5000+ lines of code in the main code section), so I develop each new 'black box' addition as a separate program, iron out the bugs, scatter test code about and generally play with the code in the separate program. Then when it's fixed & sorted, then is the time to integrate it with the existing program. I've not yet reached the point where I feel happy about freezing the code to integrate it in the chart program - one of my current problems will be how to integrate re-sizing & dithering in the same hit.

Regards,

Richard
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

Mulling over the problems of repeating the dither pattern on graduated images made me think a little: What you need is some randomness to the dither so it doesn't keep doing the same thing to the same colours. The lightbulb moment came over the weekend (while I was doing the washing-up, actually).

If you imagine scanning across an image, get the colour error for a pixel between what it should be and what it actually is, the colour error is factored and added to adjacent pixels in the following way (these are the 'Jarvis et al' dither values, the other dither methods use the same idea, but different values):

- - * 7 5
3 5 7 5 3
1 3 5 3 1
all divided by 48

where * is the current pixel, - is an already scanned pixel and the scanning is from the top to the bottom, and left to right on each line. So the pixel to the right of the pixel being considered has 7/48ths of the error added to it to slightly change the colour being considered when its turn comes to the colour conversion.

So, I adapted this idea where a random number is generated for each location, and the random number is between 0 and the figure shown below:

- - * 9 7
5 7 9 7 5
3 5 7 5 3
all divided by the sum of the random numbers. This changes for every pixel.

One randomly dithered image from this modified Jarvis process is:
Image
Then modifying the Sierra 2-4a method in the same way:
Image

I think they do away with the consistency of dithering, but possibly cause a slightly more grainy image. If Photoshop is used to merge parts of several image conversions so that the appropriate method applies only to the area where it works best, then that might give a really good conversion. However, be cautious. I don't have access to Photoshop, so cannot tell you if it changes the pixel colours when saving. I use Paint Shop Pro 5 rather than the more modern Paint for Win 7 or Gimp, as both these packages change the pixel colours on saving. It's not much, but enough to detach the colour from the DMC RGB colour value published at XStitch Treasures.com .

Now to add this idea plus a copy/paste/open/save into the conversion unit of my charting program so that conversions can be saved etc on the fly.

Regards,

Richard
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
NeedleAndFork
Posts: 980
Joined: Tue Apr 09, 2013 5:05 am

Re: A New, Free, Chart Making Program

Post by NeedleAndFork »

I think you're on to something with adding randomness in. That's what is needed to keep the patterns from repeating so consistently. That's essentially what I have been doing manually in photoshop by adding in a layer of 'noise' and blending with the image where it's needed so that it adds a bit more variation and breaks up the patterning.

In an ideal world, I'd be able to do a quick conversion.. then on the converted image, select areas and tell the program.. more colors, less colors, smoothen, add noise, etc.. and it would adjust accordingly.

That said, I'm not a programmer, though I did pretend to be one for a while till I discovered I'm a really bad coder, and ended up changing my college major to graphic design instead. So I have no idea just how much work my ideas that I keep tossing out entail.. I just know they're more than I can do! I'm actually impressed at how far you've taken the dithering issue on this - I was just asking a question, and you took it and ran!

I get what you mean about the published version not having all these extras in it yet - I ended up having a busy weekend and didn't get a chance to download and play, but I will soon! And if you want another pair of eyes on your beta (or maybe they still alpha?) versions that are playing with dithering, let me know..
My blog: Obsessed With Thread

My WIPs: Kimono Lantern Mermaid, Rovaris Alphabet Sampler Christmas Ornaments

Participant of: Ornament a Month SAL, Stitch from Stash Challenge
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

The idea of selecting an area and only doing the dithering within it was one I was getting to as well.
I am not sure how to implement it at the moment, and will want to think on it for a while. The first thought includes the need to zoom in, so that the perimeter of a lassoed area can be accurately defined. If that's the case, then I may well need other features too. Who knows, a pixel edit & colour merge may be useful.. However, I think one step at a time would probably be better.

Allyn suggested the idea that tweeding (ability to use mixed colours of threads in a strand) should be an option. That is something I'm going to investigate next, see what combinations are sensible (red-green isn't, as the hues are complementary) and see if I can't create a program to create a tweeded thread library for PCStitch 10. The library may be rather difficult, as PCStitch 10 uses a proprietary binary thread library format, and to a large extent it'll be a matter of guessing the format and trial & error until/if it works.

In the mean time I intend to get the help file updated to the latest standard, and then upload the dithering capable version later today.

Regards,

Richard.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
User avatar
richardandtracy
Posts: 5444
Joined: Wed May 28, 2014 4:27 pm
Location: Kent, UK
Contact:

Re: A New, Free, Chart Making Program

Post by richardandtracy »

OK, the modified thread conversion with dithering and scaling has been uploaded, and may be downloaded as the first download on:
http://www.chestnutpens.co.uk/misc/downloads.html
The revised thread conversion page looks like this:
Image

The zip file has a compiled HTML help file (.chm) in it, and it really comes to a pass when the help file is bigger than the executable.

I shall have to increase the numbers of symbols the program can print - dithering seems to increase the numbers of colours used and the randomised dithering increases them still further, and it's a little difficult to get the numbers in under 101.

Now onto tweeding.

Regards,

Richard.
http://www.chestnutpens.co.uk
Free Charting Program for PC's Info Zip Installation
Post Reply