@@ -25,6 +25,7 @@ String[] photoSets = {
2525 " cosmos" , " desert" // more albums here
2626};
2727
28+
2829// Each photo set may contain jpg photos of any size but they are
2930// to be named "poly0.jpg", "poly1.jpg", "poly2.jpg", and so on.
3031
@@ -80,9 +81,9 @@ void setup() {
8081 selectSet(0 );
8182 loadSrcs();
8283 loadSource();
83-
84+ imageMode ( CENTER );
8485 background (0 );
85- image (source, ( width - output . width ) / 2 , 0 );
86+ image (source,width / 2 ,height / 2 );
8687}
8788
8889void draw () {
@@ -97,7 +98,7 @@ void draw() {
9798 output = cellSort(source);
9899 output. updatePixels();
99100 background (0 );
100- image (output, ( width - output . width ) / 2 , 0 );
101+ image (output, width / 2 ,height / 2 );
101102
102103 if (printFrame) {
103104 println (" printing" );
@@ -130,14 +131,21 @@ void loadSrcs() {
130131
131132void loadSource () {
132133 loaded= false ;
134+ polySrc[nImg] = loadImage (photoSets[nSet]+ " /poly" + nImg+ " .jpg" );
133135 source = polySrc[nImg];
134- source. resize(width , 0 );
136+
137+ if (source. height > source. width ){
138+ source. resize(0 ,height ); // portrait
139+ }
140+ else {
141+ source. resize(width ,0 ); // landscape
142+ }
135143 output = source;
136144 imageMode (CENTER );
137145 background (0 );
138146 image (source,width / 2 ,height / 2 );
139147 // image(source, (width-source.width)/2, (height-source.height)/2);
140- imageMode (CORNER );
148+ // imageMode(CORNER);
141149 loaded = true ;
142150}
143151
0 commit comments