To resize a image, movie ??
in
Programming Questions
•
1 month ago
hello, I'm trying to resize a image, movie, but this function resize (),
not work for movie.
Now, first I'm trying to resize an image, the resize method, and another method to pixels [], but
with metedo pixels [], the image is not very clear.
as best I can this?
Image-Original
not work for movie.
Now, first I'm trying to resize an image, the resize method, and another method to pixels [], but
with metedo pixels [], the image is not very clear.
as best I can this?
Image-Original
///method resize()
PImage img = createImage(500, 500, RGB);
PImage myImage = loadImage("C:\\Users\\Omnimusha\\Desktop\\bleach-hd-background.jpg");
//PImage myImage = loadImage("http://wallnen.com/wp-content/uploads/2013/05/Ichigo-Bleach-03-HD-Wallpaper.jpg");
size(500,500);
myImage.resize(500, (500*myImage.height)/myImage.width);
//image(myImage, 0, 0,myImage.width,myImage.height);
println(myImage.width);
println(myImage.height);
img.loadPixels();
for (int i = 0; i < 500; i++) {
for (int x = 0; x < myImage.height; x++) {
int Index = i+ x * (myImage.width);
int ndex = i+ (x+(500-myImage.height)/2) * (img.width);
img.pixels[ndex] = myImage.pixels[Index];
}
}
img.updatePixels();
//
image(img, 0, 0,width,height);
- // method pixels[]
size(500,500);
PImage img = createImage(500, 500, RGB);
PImage myImage = loadImage("C:\\Users\\Omnimusha\\Desktop\\bleach-hd-background.jpg");
//PImage myImage = loadImage("http://wallnen.com/wp-content/uploads/2013/05/Ichigo-Bleach-03-HD-Wallpaper.jpg");
img.loadPixels();
int f=(500*myImage.height)/myImage.width;
println(f);
for (int i = 0; i < 500; i++) {
for (int x = 0; x < f; x++) {
float X=map(x,0,f,0,myImage.height);
float Y=map(i,0,500,0,myImage.width);
int Index = int (Y)+ int (X) * (myImage.width);
int ndex = i + (x+(500-f)/2) * (img.width);
img.pixels[ndex] = myImage.pixels[Index];
}
}
myImage.updatePixels();
img.updatePixels();
image(img, 0, 0,img.width,img.height);
result:
1