Image split failed --;

HI, All.

I’ve made a code that split a big image to 6x24 sub small images.
ofImage module, cell;

void ofApp::keyPressed(int key){

int xx=0;
int yy=0;
if(key=='s' or key=='S') {
    for(int x=0; x<24; x++){
        for(int y=0; y<6; y++){
            xx= x*round(7500/24.0);
            yy= y*round(3750/6.0);
            cell.cropFrom(module, xx, yy, round(7500/24.0), round(3750/6.0));
            string filename = "/Users/kerbal/Desktop/"+ofGetTimestampString()+".jpg";
    ofSetWindowTitle("144-Cell images Saved OK.");


but some sub image is strange something like this…

What’s wrong to my code?


from @bemoregt.

I fixed It.

using floor() instead of round().


1 Like