We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am currently a student and have been experimenting with a design in Illustrator, which I would like to develop further using processing. The program basically would divide a vector image into equal quarters along the x and y axis. It would then proceed to rotate the image to create patterns. Can anyone help? Further details and an image example can be provided. Thank you.
Answers
what kind of vector image? What extension does it have? dxf / svg ?
or do you mean just a image like jpg?
I have designed the image in Illustrator but I would save it as a jpg in Photoshop.
what do you study?
do you offer money - then place it in section jobs...
or show your code - then we can help
I am studying Graphic Design course and I would like to do have a program that would randomly produce patterns to set instructions. I am not sure how I would go about coding this.
please do
(I don't have time but it's interesting)
Please see attached experiment with info. Hope you can see the text. Thanks
It's easy
Use loadImage to load the image
Look at reference for loadImage
Once you have that say image (img, 0,0);
Now use
PImage subImg1 = img.get(0,0,img.width/2,img.height/2);
To get a section
Say
image(subImage1, 200,200);
Etc. .....
image is 256x256 (change SIZE to change this)
draws each of the quarters with a random rotation (or not at all)
mouse click for next combination
Thanks guys! I will give it a go and let you know how it works.
(chrisir, this was actually quite complicated and it took me a while to figure out how to do it. cutting the thing into 4 bits and then rotating the bits in place was kinda tricky - you'd have to rotate around their centres, something i didn't think you could do using pimages and rotate without copying the 4 quarters to separate images)
reading the text on the image, i think you may've wanted the combinations of things more constrained than i made them - would need more logic. conversely, i think it could probably be simpler if you're only going to use images that are rotationally symmetrical like the one in the example - basically you'd just supply one quarter of it and wouldn't need to split it up any further.
@koogs, I am sorry that my assessment was wrong (not easy...)
don't worry, it was fun 8) and i'm quite pleased with my shifting-texcoords-to-rotate solution, even if it is a bit clunky.
I am on a journey, so I couldn't do it...
So thank you.....
;-)
koogs, I have just got back and trying out your code. On line 2 I have input "symbol_01.jpg"; and have ensured that the file is located in the data folder. When I run the code an error message occurs with line 39 highlighted stating 'cannot find a class or type named "List". Not sure what I need to do.
at top of file add
import java.util.List;
i think this (the default imports) may've changed between processing versions
works fine in 1.5.1
in 2.0.a5 i had to change renderer to P3D
no missing List in either.
Processing 2.x.x should import both List & Map again, since they don't interfere w/ JS Mode! [-(
Hi Folks, Did as you said but I got a black screen. When I click the mouse white squares appear with no image. So I tested it with a photo image png and it cuts and rotates the image but the cut images are distorted and they are not appearing in combinations of diagonal pairs only. It seems that the screen size affects what is seen in the cut image. Also it doesn't give a combination of patterns at the end. My apologies I should have explained it a bit better initially. Here it is again below. Thanks very much!
yeah, the 'diagonal's only' requirement was only added when you posted the picture and i didn't see it until later (text was too small!)
image needs to be 256x256 pixels. or you can change the 256 in the code to match the image dimensions (keep it square)
what i'm doing is taking the original
and rotating A randomly in place, B randomly in place, C randomly in place and D randomly in place. that's all. anything else would be more than 70 lines 8)
Thanks for the response but I would I get someone who will be able to do the project and make it work the way I would like it? Thanks again.
Listen, Crane, is this homework?
When you are too lazy to do it, at least type down what is written because the text in the image you posted can't be read here
Also, koogs did excellent work here. Why not be a man and work with what he did for you yourself?
then come back with substantial questions on the code of yours.
Chrisir
it's readable (just) but it's the kind of thing that's easy to write, less easy to code. how can i tell, for instance, if it's a two-pair or a four-pair?
code needs a refactor to handle the tiling too. (write to pgraphic, tile that)
also, it's the world cup.
Thank you for your response. Koogs work is great! It is not that I am lazy this is a small part of a larger project. The design is my own and I wanted an efficient way of working with this project. I have done over 150 different designs that would have to go through the same rules which I did start by hand but realised that it would be unrealistic for me to do considering the amount and time constraints in addition to the other parts of the project that this feeds in to. I am not a programer and I came to the knowledge of processing recently. I am not good in this area, I would love to be but the time does not permit and the question was could someone do it for me. Later this evening I will send the text again. Apologies. Enjoy the World Cup.
a lot of the problems fell away when i came to do it. and i could reuse the code for generating the 2x2 tile to generate the 4x4 tile using the new 2x2 tile as input...
oh, now takes one image, a quarter of the original, 128x128 here, and rotates that as necessary. this is as per step 2 of june 16 post.
Thank you for this. Sorry for not replying sooner I have been working on other areas of my design work. I will run through the code and let you know how it works. Thank you again for working on this and your time spent on it.
Hi Koogs, I have been looking at the code you have written and I am not sure how the code is calculating the image. Does the image need to be a specific size for it to work? I have input the above image ( the circle) and the following is displayed.
I couldn't see what was going on so I tried a test image (bird) and the following came up.
In some parts the full image is seen in others it cuts the image but not into equal 1/4s. Not sure what can be done. Thank you for the time you have spent working on this so far.
and it's there on line 4 of the code:
private final static int SIZE = 128;
should work if you change it. and there doesn't look to be a reason why it can't work out the size from the image anymore. only size() is hardcoded.
change line 4 to
and add after line 12
and then it'll work with any square image.
(actually, it won't, there's a problem somewhere, first square is ok, second square is distorted. will fix it.)
ok, there's a further limitation, one i can't currently think of a way of fixing but there is a workaround:
the size of the screen in line 11 has to be at least 4x the size of the image in each dimension. if image is 250x250 then the size has to be 1000x1000.
(i use the screen whilst composing the tiles but if the screen is too small then it'll clip them, make them rectangular.)
Oh, thanks Koogs, I will do as you instructed and work on it later tonight. Thanks again.
if you add, after line 59
and after line 37
then it'll save out the tiles so you can play with them yourself
Hi Koogs thank you so much for your help with the coding, unfortunately the output does not appear to be working. It comes with an error message 'cannot find anything named "size" ' for SIZE = img.width; Thanks again for the work and time you have taken in this project.
what i hate about this thread is the 2 week delays between bug reports 8)
that runs fine for me, i can only suggest there's a problem with your edits. but i'll post the whole thing again shortly so you can just copy it verbatim. but first i'll try and get rid of the size limitations mentioned above.