Site API?
Reply
IndyHaine
Bracelet King
IndyHaine
1 year, 6 months ago by IndyHaine
Hi,
I wanted to ask if there's an open API of this site. I'm starting a rather large pattern and have been musing over how to keep track of where I am, and since I'm a software engineer, the easiest thing that came to mind for me, was just having the pattern with a counter on every column (as it is now on rows).

That's easy enough to do by taking screenshots of the pattern and then putting a layer with numbers above it in any image editing software, sure, but since I'd have to do this over and over again, having it done by a machine appeals to my lazy programmer brain haha

(Plus, if I'm completely honest, I'd just like to program something that is not my job for a change.)

No worries if there is no API, since I couldn't find anything when I looked around, it's more probable that there isn't. And I can always try extracting the rendered html straight from the site and convert it into a json of the pattern or something.
Just wanted to ask in case there is something like an API that can save me a lot of work.
halokiwi
Super Moderator
halokiwi
1 year, 6 months ago by halokiwi
I've got no idea, but I let admin know that there is a question that he will probably be able to answer best 🙂

Even though I don't really understand what your question is about, this seems like a good idea to me. Many users have requested a column count in patterns similar to the row count we have.

I assume your question is in regards to alpha patterns. Personally I use a pixel art app to draw my designs, export the pixel art so one square in it is actually one pixel, then I import it into the generator using "alpha from image". What I want to say is that you don't need to use "draw alpha", you could use a program instead that offers what you are looking for and then later import the pattern.
IndyHaine
Bracelet King
IndyHaine
1 year, 6 months ago by IndyHaine
Thank you for the super quick reply! 😊

You're right, I was talking about alpha patterns. But I realize now that I probably used the wrong words: What I meant is, I'm starting wall hanging that is made from a rather large alpha pattern already on this site. I was planning to use a paperclip to attach a small paper to every 5th or maybe 10th base-string, so when I for example need to make a row with 17 black knots, then a single white knot, 13 more black ones, then one white, and so on, then I don't need to count every string from the beginning of the row to check whether I'm already at a white knot or not. (I have a very small concentration span, so I need to recount a lot instead of counting once and then be done with it, and I'm trying to accommodate for that with tricks like this).

So with this setup, if I could also mark every 5th column in the pattern I'm copying, then that would save me a lot of work. Until now, I usually made a screenshot of the patterns I'm knotting, and then draw a red line down every 5th column in gimp. The problem this time is, that the pattern is very large, so I would probably have to do that quite a lot of times, and the more often I do it, the more prone to error I am because I don't want to triple check everything.

This is probably a none issue for most people, but for some reason I'm really bad at counting haha.... I swear I'm good at maths. Just counting and remembering specific numbers when I have not written down is usually a disaster for me unless I concentrate really hard. This is a bit embarrassing.
Rowsitt
Bracelet King
Rowsitt
1 year, 6 months ago by Rowsitt
all i got from this was numbers for the columns of strings for alpha and i agree! especially for big patterns, one string can mess up the entire rest of the most
Rowsitt
Bracelet King
Rowsitt
1 year, 6 months ago by Rowsitt
*rest of the pattern
halokiwi
Super Moderator
halokiwi
1 year, 6 months ago by halokiwi
I can relate to that a lot even though I rarely knot alphas and I've never knotted a really big one. Math is great, but remembering numbers: nope!

I think it would be useful, if in the pattern grid some of the lines where thicker like it is common in cross stitch patterns. Would that help you?

I think drawing these lines in yourself is a great idea, but I can understand that it might take lots of patience and concentration. I also struggle with that.
IndyHaine
Bracelet King
IndyHaine
1 year, 6 months ago by IndyHaine
Yeah a thicker line on certain column-counts would really help, I think! Especially with patterns that have more than 50 columns.
Admin
Administrator
Admin
1 year, 6 months ago by Admin
Hello @IndyHaine,

No, we don't have an open API, but I think this could be done very easily even without it. The easiest way to do it would be just taking the images we already have (the server also generates PNGs for all of our patterns) and then just annotating them with imagick or something similar (depending on the programming language of your choice). That should be pretty easy to do and should also resolve your problem, if I understand your question correctly. There is no need to play around with the pattern data and generating the image from scratch, since that part is already done for you and you only need to add the lines. You should be able to use the image dimensions to compute how many lines you need.

And also, one thing I wanted to point out is that all of our patterns are covered by the copyright laws. If you'd like to do this just for yourself, that's completely fine, but you can't re-use our pattern images or even the data from our patterns to create a public service for this. That would be both against our rules and also against the copyright laws.

I like your idea btw and so I marked it down to my todo list. I'll definitely be thinking about adding such a functionality to the site very soon, because I can totally imagine this being very useful for all of our users! 🙂
Admin
Administrator
Admin
1 year, 6 months ago by Admin
Here's an example of the PNG links:
https://media.braceletbookcdn.com/patterns/000/000/137/069/000000137069/preview.png
https://media.braceletbookcdn.com/patterns/000/000/137/069/000000137069/pattern.png
IndyHaine
Bracelet King
IndyHaine
1 year, 6 months ago by IndyHaine
@Admin thank you so much for your reply!
That is absolutely a better idea than what I had in mind, thank you! I haven't worked with imagemagick in ages and it's due for a refresher, so this is perfect.

And don't worry, I just want it for myself, privately. I'm european too, so copyright laws are extremely strict here anyways, and I always assume I can't just publish something that is derived from someone else's work.
kaevm
Beginner
kaevm
8 months, 3 weeks ago by kaevm
This looks great! I'm new to programming, but I'm curious to know, how would you use ImageMagick to do this? I've mostly learned Python so far.
IndyHaine
Bracelet King
IndyHaine
8 months, 3 weeks ago by IndyHaine
@kaevm you can use Python to access ImageMagick: https://wiki.python.org/moin/ImageMagick
To be completely honest, that's the only way I ever used ImageMagick.
kaevm
Beginner
kaevm
8 months, 3 weeks ago by kaevm
Thank you! Although looking at the two previews that were shared, I'm going to be honest, I have no idea how to get to the second. Did you end up coding this?
IndyHaine
Bracelet King
IndyHaine
8 months, 3 weeks ago by IndyHaine
@kaevm I didn't get around to it. Without my boss telling me I have to be done tomorrow, I seem to never finish coding anything haha.
But at work, we have a whole digital asset management system setup with ImageMagick, it works quite. Just the setup is sometimes a pain in the behind.
Reply