We are about to switch to a new forum software. Until then we have removed the registration on this forum.
//trying to make the image fit within the screen. //I did try adding the pixel sizes with image (img,0,0,1000,1000) it worked //but I might not always know the image size so how to make it automatic //BTW this code must be so bad it hung my PC.
PImage img; //image is 1000x1000 pixels
int x = img.width; //x is same as image width
int y = img.height; //y is same as image height
Void setup() {
size (x,y); //screen size is same as image
img = loadImage ("01.JPG");
}
voif draw() {
image (img, 0,0);
}
//I need to know how to manipulate image sizes without distorting the propotions
Answers
To setup the sketch to have the same size as your image, you need :
https://processing.org/reference/settings_.html
If you want to resize your image to the same size as your sketch while keeping the proportions, you need to call resize with one of the parameters set to zero as described here next:
https://processing.org/reference/PImage_resize_.html
However, you will need to resize your sketch to fit your sketch around your resized image.
Kf