It is currently 27 Nov 2020, 20:04

• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Generate Cross Stitch pattern and DMC thread information Script for GIMP

Share your Python Fu Scripts/plug-ins for GIMP here
enxio27
Forum Member

Re: Generate Cross Stitch pattern and DMC thread information Script for GIMP

Post#61 by enxio27 » 02 Mar 2019, 05:05


Well done! It looks awesome! I hear you on the focusing, though. I didn't wear reading glasses until I did a beading project (with seed beads) that was about 30"x6". It took me four months to complete.

If you're interested, you might look at cloth with larger threads (fewer threads per inch). They're a bit easier on the eyes.
GIMP Learn rocks...

tim
GL Blogger

Post#62 by tim » 02 Mar 2019, 05:50


Well I was more interested in making something that cross-stitchers could use.

I only tried that Wilber because I wanted to prove the process works (I looked at the result using the Ipad that no longer works or we got locked out because we don't know what password we originally used and phoning support didn't help and we don't have the bill for it anymore so we can't prove to them that we own it but that's another story).
aka Tin

         

tim
GL Blogger

Post#63 by tim » 02 Mar 2019, 16:22


Updated with version 6. For GIMP 2.10.X. Converted from UTF-8-BOM to UTF-8 encoding so that it would run/show up on Windows.
aka Tin

         

tim
GL Blogger

Post#64 by tim » 25 Jun 2019, 20:47


Updated version 7 for GIMP 2.10. - To use symbols instead of hex digits. I think it's friendlier for cross-stitchers to identify symbols.
cross-stitch-symbols-instead-of-hex-digits.png
cross-stitch-symbols-instead-of-hex-digits.png (147.49 KiB) Viewed 6298 times
aka Tin

         

chellecraft
Forum Member

Post#65 by chellecraft » 26 Jun 2019, 01:45


Hi Tin, I've been having fun with your GIMP plug-in, which I got to work for me in the latest version of GIMP and windows 7. I've used it to generate a couple of charts. The questions I have is how to ensure the generated chart will be suitable for other stitch crafts.

In my case I'm attempting, for the first time, some Tunisian Crochet colour work. Your program generates a beautiful output that more closely resembles my original image, but treats the whole picture as one flattened perspective. Which means, the further away from the viewer, the more detail there is and then lots of single pixels (stitches) in different colours. The problem being lots of colours being carried across the work for no real benefit to the final product.

As I'm new to craft stitch pattern generating as well as GIMP, I realise I still need to play with my original image to place the focus on the foreground, and somehow blur or reduce the pixellation in the background. I also need to learn how to deal with random pixels, that are errors of the editing process. If you have any tips to assist or tutorials to point me towards, that would be awesome :)

The question I have regarding the Tunisian work relates to how I worked around the "one pixel does NOT equal one stitch". The yarn and hook size I'm using for my project, which I tested on a sample, creates a ratio of 10 horizontal stitches per 7.25cm and 12 stitches vertically per 10cm. When I placed this information in another program (stitchfiddle) the program generated values of 0.84 horizontal and 1.19, or 143 horizontal stitches (pixels) wide and 204 pixels tall for a final project with dimensions of 100cm by 170cm which information I used to scale my image. I entered the horizontal and vertical data in as X=horizontal and Y=vertical.

Before embarking on the project I was wanting to ensure I'm on the right track. Do you think my reasoning is correct? That is, once created with these ratios, will the final project closely resemble the original image or just be a mishmash of semi random colours?

As a final question, I am using a very limited palette, relating to the yarn I already have on hand. Is it possible to somehow select the yarn colours I have and then have the pattern generator use this palette to create the project? Or to ask the generator to create the pattern using two greens (dark and light), four shades of brown, a cream, two blues etc?

Thanks for your help and the awesome plug-in.
GIMP Learn rocks...

tim
GL Blogger

Post#66 by tim » 26 Jun 2019, 05:32


When you run the plug-in you can specify how many horizontal-stitches you want your final image/pattern to have.
That's one control if I understand what you're talking about correct.
What you can also do is try to resize your original work to the scale that you'd like represented in stitches count for example if you want 50 stitches across, just scale it down to 50 pixels width then you can choose the INTERPOLATION method when you scale....some NO INTERPOLATION produce better image. then when you generate the pattern enter 50 as horizontal stitches..and it'll preserve all your pixels.

This plug-in wasn't designed with a different palette.
However, I can make an alteration to the plug-in and call/name it something else to read from a selectable palette with some sort of name or IDs or combination of both as the palette's individual colours names, that way when the pattern is generated it can print out the color and the name (ID string of that color's name)...
Then you'd just have to maintain the palette, like if you buy new yarn color, you can add it to the palette, and if you run out you can remove it from your custom palette.
Let me know if this would work for you, and I'll start working on it.

UPDATE: I went ahead and created a plug-in (altered from version 9 of this plug-in) that accepts a (custom) palette as input. The palette could be colors of your yarn that you have on hand. see: viewtopic.php?f=3&t=2461
aka Tin

         

chellecraft
Forum Member

Post#67 by chellecraft » 26 Jun 2019, 06:48


Thanks for your reply Tin, I realised after I'd posted, that I'd made a confusing error in describing what I was trying to achieve. Yes, the number of stitches wide will coincide with the scale of the image (in pixels) I set which I can then also input in your pattern generator. My concern is that 1.19 pixels per cm (or 1.19 stitches per cm) for the horizontal may screw with the final pattern, as the vertical proportions are 0.84 pixels per cm. That is, the stitches are not a square but a rectangle, which I felt may distort the final image. I attempted to overcome this issue by inputting the aspect ratio at X and Y and wanted a second opinion on my possible solution.

I got the aspect ratio calculation from the other program, I'm not sure how they calculate the final figures but it was from the swatch I'd made in testing the yarn, stitch type and hook size.

That is - 12 stitches over 10cm for the vertical and 10 stitches over 7cm for the horizontal, when inputted, gave a gauge of 14.51 in the horizontal plane and a result of 12.19 in the vertical plane which were converted to the aspect ratios quoted above. Yes, I also set the horizontal and vertical pixel number for scaling the image via this calculation too, prior to running your cross stitch plug in. It's how this image data is interpreted which is what I believe makes your program superior, with a clearer final image closely resembling the original.

I will also implement your suggestion regarding the interpolation method, but bare your cautionary note in mind, in that no-interpolation may produce a better result.

Do you think, in editing my image, the steps I should take would be to identify the foreground portion of the image, apply a sharpen to this, etc. While for the background and perhaps separate midground, reduce the focus in some way? I've looked at a youtube video which takes the viewer through the steps of creating an oil painting from a digital image, and thought that may work as a general guide. My next step would to scale the image to the number of pixels wide and tall, and potentially the x and y aspect ratios, prior to running your plug-in, using the horizontal pixel number here too.

In regards to your offer to work on a way for users to determine their palette - only do so if there's call from other GIMP users as it seems like a lot of work for just one person.

There's no great hurry though, as I'm going to have to put a temporary halt on the project, and come back again in a month or so. A summer holiday, in the middle of our winter down under, beckons.

Thanks for your help and feedback, Chelle
GIMP Learn rocks...

chellecraft
Forum Member

Post#68 by chellecraft » 26 Jun 2019, 07:06


Wow! Just Wow!!

So while I was out working in the yards and letting my mind drift to something more fun aka GIMP, your pattern generator plug in and getting it all to work for me - you went and created another little bit of coding.

So very generous!

I'll download now and have a play

Thanks again, Chelle
GIMP Learn rocks...

tim
GL Blogger

Post#69 by tim » 26 Jun 2019, 17:02


"12 stitches over 10cm for the vertical and 10 stitches over 7cm for the horizontal"
So it's not 1:1... Let me try out some math for this
7cm/10 stitches = 0.7 cm/horizontal stitch
10cm/12 stitches = 0.83333 cm/vertical stitch
So the aspect ratio of your yarn project is 0.7:0.83333 remember this number.
hmmm...some brain storming.
let's use an example of aspect ratio 2:1 (aspectX:1) (of yarn aspect stitch) mean if a stitch was double in width.
we want an the pattern to be 1/2 or 1/aspectX in width so that when we're finished we have a finished product of 1:1 because 1/2*aspectX = 1.

So with 0.7:0.83333 convert it so that we get aspectX:1 to find aspectX.
aspectX = 0.7/0.83333 = 0.84/1 or 0.84:1


when we scale it (before using the generate pattern plug-in), unchain the aspect ratio lock, divide width by 0.84 (just type "/0.84" following the current width, it'll do math for you). Leave height unchanged because it's already aspect of 1 from our (0.84:1).
And we shall have an image that is adjusted so that after we generate the pattern (if we scale the pattern to aspect ratio of 0.84:1) it'll look the same as the original image with correct aspect ratio.

Images to prove the process of scaling before running plug-in and scaling after on generated pattern.
original image
original image
original_image.png (27.99 KiB) Viewed 6278 times
scaled by dividing width by 0.84 then applying pattern in this case just square grid as example
scaled by dividing width by 0.84 then applying pattern in this case just square grid as example
pattern applied after scaling by dividing width by 0.84.png (26.51 KiB) Viewed 6278 times
what our pattern would look like it the aspect ratio of our material was applied...the logo looks correct again
what our pattern would look like it the aspect ratio of our material was applied...the logo looks correct again
scaling pattern by multiplying width by 0.84 makes the logo look right again.png (29.61 KiB) Viewed 6278 times
aka Tin

         

tim
GL Blogger

Post#70 by tim » 27 Jun 2019, 18:21


Version 10 - prints out sizes (in inches and centimeters) for aida 14,16, and 18 count (at bottom of thread info image).
cross-stitch-plug-in-thread-info-now-has-sizes-of-aida-cloth.jpg
cross-stitch-plug-in-thread-info-now-has-sizes-of-aida-cloth.jpg (67.22 KiB) Viewed 6268 times
aka Tin

         


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply New Topic
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 11 guests