Tuesday, 15 July 2014

Scaling an array of Images Java -



Scaling an array of Images Java -

i attempting rescale array of images have same width , height. having problem returning array. help great.

public static picture[] resize(picture[] slides, string[] args) { int w = 298; int h = 298; image [] source = new image [integer.parseint(args[0])]; ( int ti = 0; ti < w; ti++){ (int tj = 0; tj < h; tj++){ image [] target = new picture[ti+1]; int si = tj * source[ti].width()/w; int sj = tj * source[tj].height()/h; target[ti].set(ti, tj, source[0].get(si, sj)); } } homecoming target; }

your question bit unclear, , source code confusing. seems need edit array passed in. modify copies input array , creates new array, system.arraycopy() accomplish this.

i have attempted reply believe needed, not know api image class. utilize set(...) have in illustration instead of api calls have used.

public static picture[] resize(picture[] slides, string[] args) { int w = 298; int h = 298; for(picture : slides) { i.setheight(h); i.setwidth(w); } homecoming slides; }

java image scale

No comments:

Post a Comment