Hi, I want to ask, is there a script I could use to recreate an image I have and convert to a suitable format where I can make modifications to the image ?
Hi @techmouse,
you can do s.th like this …
Cheers
— mnse
void setup() {
// load a src image
PImage src = loadImage("image.jpg");
// create target image with the same size
PGraphics dst = createGraphics(src.width, src.height);
dst.beginDraw();
dst.image(src, 0, 0); // draw src to target
// and do some modifications (ie draw a cirle at the center
dst.fill(255, 0, 0);
dst.noStroke();
dst.ellipse(dst.width/2, dst.height/2, 100, 100);
dst.endDraw();
// save the modified image
dst.save("image_out.jpg");
exit();
}
@mnse Thanks for responding. I tried this code, was something suppose to happen? A screen popped up and closed.
I just noticed that my image has a red circle on it.
Hi @techmouse,
The red circle is only something to demonstrate.
Don’t know what you want to apply to the image by your sentence…
Instead of the circle you can nearly apply everything you want with that approach.
Cheers
— mnse
Well I wanted a script to reproduce an image that I have, like recreating it and then being able to save it to a format where I would be modify the image in a another graphic design tool.
Do you mean this in the sense that the program analyze the image and when there is a circle and a rectangle it writes code to reproduce this?
Analyze and photocopy the image as exact as the original, and I would be able to save it in a format where I can use it in a graphic tool.
Which format is it now
and what is your target format? Png?
Hello @techmouse,
The links below may help.
Tutorial:
References:
https://processing.org/reference/PImage.html
:)
Hi @techmouse,
Please describe a bit clearer what analyze means to you, and under which circumstances do you want to save it to another format and to which format ? The source image is jpg as suggested in you title !? Didn’t your graphic tool support jpg !?
Cheers
— mnse