We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello guys,
I am working on an image processing program. I notice that when I type some words onto a PImage, and try to save the PImage, the text is saved in jpg? Any ideas?
class Text {
PVector textLocation;
String string;
float textSize;
color colour;
Text (PVector textLocation) {
this.textLocation = textLocation;
textSize = 18;
colour = color(0);
}
void display() {
if (textOn && !(string == null)) {
fill(colour);
textSize(textSize);
text(string, textLocation.x, textLocation.y);
}
}
}
my project link https://github.com/Finaros/Pixcell Thanks!
Answers
Would you be willing to learn how to program with objects to make this a much better program? Do you have the time to do so? What I'm trying to ask is... is this a homework assignment or a personal pet project of passion?
Cuz it's already code spaghetti.
This is an assignment from school. And yes, I know it's messy... Do you know any ways to make it work?
Right. So you have the image loaded into some PImage variable, right?
You can display that PImage directly on the screen, but for drawing on it, that isn't super useful - it's not easy to draw things on a PImage.
The best thing to do would be to use the PImage as a background in a PGraphics object. Then you can draw on the PGraphics object easily. You can also get the resulting image from the PGraphics object.
Here's a quick example:
This is not the best example ever, sorry. Click somewhere on the right side to set the text position then type some letters to make text. Right click your mouse to save the image.
Thanks, TfGuy44, I really appreciate it!
I am trying to save changes so i can always go back, but the following code isn't working. Plz help!