stevec Posted March 24, 2007 Share Posted March 24, 2007 I need to take two identically sized and shaped images (they happen to be labels) and divide them both into 48 smaller square pieces -- a grid 8 across and 6 down. I tried manually cutting the image(s) into rectangles and cutting and pasting, but its real hard to get the pieces to be the same size and I haven't even tried it for the second image! Please to help! Thanks a lot. Steve Quote Link to comment Share on other sites More sharing options...
Illnab1024 Posted March 24, 2007 Share Posted March 24, 2007 1) Add a new layer. 2) Run this codelab script. void Render(Surface dst, Surface src, Rectangle rect) { PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); int GridSizeX = selection.Width/8; int GridSizeY = selection.Height/6; ColorBgra CurrentPixel; ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor; bool Odd = false; for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (selectionRegion.IsVisible(x, y)) { CurrentPixel = src[x, y]; Odd = true; if (((x / GridSizeX) % 2) == 0) Odd = false; if (((y / GridSizeY) % 2) == 0) Odd = !Odd; if (Odd) { CurrentPixel.R = (byte)PrimaryColor.R; CurrentPixel.G = (byte)PrimaryColor.G; CurrentPixel.B = (byte)PrimaryColor.B; CurrentPixel.A = (byte)PrimaryColor.A; } else { CurrentPixel.R = (byte)SecondaryColor.R; CurrentPixel.G = (byte)SecondaryColor.G; CurrentPixel.B = (byte)SecondaryColor.B; CurrentPixel.A = (byte)SecondaryColor.A; } dst[x, y] = CurrentPixel; } } } } 3) Use the magic wand to draw a selection for one of the squares. 4) Crop to selection. 5) Delete the top layer. 6) File > Save as... to the filename of your choice. 7) Undo until the end of step 2 and repeat the process for the next rectangle - repeat until finished Quote ~~ Link to comment Share on other sites More sharing options...
stevec Posted March 24, 2007 Author Share Posted March 24, 2007 Thanks a lot --but I do have to state my probable inability to carry this out. While I am 100% certain that this would work, and I greatly appreciate the quick reply, I wouldn't know where to begin entering these commands! My experience with Paint.net is limited to pretty basic cutting, cropping, resizing, a little bit of retouching and the like.....The common stuff on the menu bars.... So any further hints would be so helpful. I'm willing to learn -- just need a bit of help about where to start... Thanks again, Steve Quote Link to comment Share on other sites More sharing options...
Leif Posted March 24, 2007 Share Posted March 24, 2007 Not sure if i can figure it out eider. But here are two useful links if you don’t know CodeLab. http://paintdotnet.12.forumer.com/viewt ... sc&start=0 http://boltbait.googlepages.com/codelab And one for installing CodeLab: http://paintdotnet.12.forumer.com/viewtopic.php?t=2023 Quote My DA: http://leif-j.deviantart.com/ -------------- Some people seek justice so persistent, that they will do great injustice themselves. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.