save jpg
in
Programming Questions
•
2 years ago
Hello
I want tu cut an image !
I have a red image when I save with 2 way in jpg.
png is ok !
Why ?
What is the solution ?
void setup()
{
size(1200,800,P3D);
PGraphics pg = createGraphics(800, 800, P2D);
PImage img = loadImage("image.jpg");
PImage res;
//pg.beginDraw();
pg.copy(img,400,0, 1200, 800, 0, 0, 800, 800);
res = pg.get(0, 0, pg.width, pg.height);
pg.save("pg.jpg");
//pg.endDraw();
res.save("res.jpg");
image(res,0,0);
}
{
size(1200,800,P3D);
PGraphics pg = createGraphics(800, 800, P2D);
PImage img = loadImage("image.jpg");
PImage res;
//pg.beginDraw();
pg.copy(img,400,0, 1200, 800, 0, 0, 800, 800);
res = pg.get(0, 0, pg.width, pg.height);
pg.save("pg.jpg");
//pg.endDraw();
res.save("res.jpg");
image(res,0,0);
}
1