Jump to content

Plugin request - a variation of the pixel counter plugin


Recommended Posts

In fact, if you want to save the trouble of manually using the rectangle tool to get at the edges, you can use the magic wand tool to select what you need a measurement of and it will give you the dimensions of the bounding rectangle in the info bar at the bottom of your screen.

EDIT: I've been ninja'd!

Putting the information into a spreadsheet automatically is a different story altogether. I don't know if that is within the capabilities of a plugin, but if it is, I know several plugin authors around here that would be able to figure it out faster than I can type a response.

 

what I do all summer Emote Cursor Pack 'noob gallery

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

A Comma-separated values (CSV) based spreadsheet wouldn't be difficult, as the format(s) of the file is dead simple.

 

I'm not necessarily volunteering to make this, but more information is needed.

-Do you want to ignore all the white pixels? or just the ones on the edges before there is a black pixel?

-Do you have an example of how you would want the spreadsheet to formatted?

-Would the plugin create a new spreadsheet every time it is run? or append to an existing one?

 

Anyone know if plugins have access to DPI information?

Edited by toe_head2001
Link to comment
Share on other sites

I've published a CSV filetype - sing out if you want the code Toe-y.

Link to comment
Share on other sites

Here is an example of how the spreadsheet would look except there may be more than 2 columns if there is a break in the non white pixels. It would create a new spreadsheet each time it is run. In the sample image there are open areas within the image so there may be multiple beginning and ends of pixels within one column. This would be used for a book folding pattern and would allow one to to cut and make more than two folds per page.

Edited by heathersharmony
Link to comment
Share on other sites

Is there a way to have it measure the beginning and end of areas of pixels in an image and show them either in cm or inches as in the photos?

 

It has to be a very accurate photograph that would match the book exactly. If it had a height and width box for output scaling would that do?

 

 

For the other programmers : Here's the original http://forums.getpaint.net/index.php?/topic/26946-counting-filled-cells-in-column/?p=395666

Here's the original code

Hidden Content:
// Name: PixelCounter
// Title: PixelCounter

#region UICode 
bool Amount1 = true; // [0,1] 
#endregion 

void Render(Surface dst, Surface src, Rectangle rect)
{
     if (Amount1){
           Rectangle sel = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
          dst.CopySurface(src, sel.Location,sel);
         //========================= 
          Amount1=false;
          try {
                System.IO.StreamWriter pc = new System.IO.StreamWriter(@"C:/count/pixelcount.txt",false);
                pc.WriteLine("Begin Count:");
                pc.WriteLine();
                pc.Close();
                for (int x = sel.Left; x< sel.Right; x++){
                    int toppix=0;
                    int pixlength=0;
                    
                    for (int y= sel.Top; y< sel.Bottom;y++){
                        ColorBgra CP= src.GetBilinearSample(x,y);
                        int total = CP.R + CP.G + CP.B;
                        if (toppix ==0){
                            if (total<765){
                                toppix=y;
                                pixlength=1;
                            }
                        }else{
                            if (total<765){
                                pixlength++;
                            }else{
                                System.IO.StreamWriter pcr = new System.IO.StreamWriter(@"C:/count/pixelcount.txt",true);
                                pcr.WriteLine("Column" + x + " Top=" + toppix + " Length=" + pixlength);
                                pcr.WriteLine();
                                pcr.Close();
                                toppix=0;
                                pixlength=0;
                            }
                        }
                    }
                }
                System.IO.StreamWriter pce = new System.IO.StreamWriter(@"C:/count/pixelcount.txt",true);
                pce.WriteLine(":End Count");
                pce.WriteLine();
                pce.Close();
                
            }catch(Exception e){}
     }else{
      //======= next code is a keep alive for dialog box 
     //so users know its working. 
            ColorBgra CP=dst[0,0];
            dst[0,0]=CP;
     }
}
 

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

I tried out the pixelcounter2 and I think it's starting top to bottom and measuring white areas. I need it to measure from left to right. It can keep it in pixels if that is easier but I would need to know how to convert it then to centimeters or inches. Also when I opened it in excel it had blank rows between each page number. Is there a way to have duplicate pages go,across the sheet....having more columns in the spreadsheet? The one pattern I tried it on ended up with over 200 pages trying to print out :(

Link to comment
Share on other sites

 

 

Can the original pixel counter plugin be used this way? 

yes it did multiple folds per page 

 

pages were scanned top to bottom before moving left to the next page.

 

 

 

It needs to read the image from left to right since that is how the pattern is followed for marking the book. 

Like this?

https://www.dropbox.com/s/cyhaw5avcjn0ls5/Like%20this.png?raw=1

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

Are you absolutely sure you want left-> right  then Up_Down. That's totally different from the first pixel counter 

 

That would make the page numbers no longer sequential? I can flip it but the results doesn't make sense.

 

Attached is an update with 2 columns.

 

 

 

Just put type in the book height in inches and it will calculate the ruler measurement for the fold.

pixelcounter2.zip

Go out there and be amazing. Have Fun, TR
TRsSig.png?raw=1
Some Pretty Pictures Some Cool Plugins

Link to comment
Share on other sites

it seems to be working but I am confused as to why my first few folds say page zero.  I will attach the image I used and the pixelcounter result.  Is it possible to have the first column be page # and second and third columns be the fold# like this:  Page 1         Fold 1

                                                                                      1                        2

                                                                                       1                        3

 This way when you have three folds to be cut on page 1 it would be easier to make sense of.                                                                                       

 

 

It wouldnt let me attach the csv file to show you.

 

 

 

 Fold#   Page#  Start  End    Fold#   Page#  Start  End 1 0  1.56 in.   1.57 in.   46 49  3.78 in.   4.71 in. 2 0  1.81 in.   1.87 in.   47 51  2.10 in.   3.04 in. 3 0  1.99 in.   2.37 in.   48 51  3.88 in.   4.75 in. 4 0  5.62 in.   5.63 in.   49 52  0.99 in.   0.99 in. 5 0  7.67 in.   7.92 in.   50 52  1.57 in.   1.57 in. 6 4  3.26 in.   3.29 in.   51 52  2.10 in.   2.97 in. 7 4  5.04 in.   5.09 in.   52 52  3.94 in.   4.75 in. 8 5  3.23 in.   3.30 in.   53 53  0.99 in.   0.99 in. 9 9  5.99 in.   6.19 in.   54 53  2.08 in.   2.91 in. 10 10  5.97 in.   6.15 in.   55 53  3.99 in.   4.78 in. 11 14  2.73 in.   2.78 in.   56 54  2.06 in.   2.88 in. 12 14  3.52 in.   3.64 in.   57 54  4.04 in.   4.80 in. 13 14  3.90 in.   3.92 in.   58 56  2.04 in.   2.81 in. 14 15  3.40 in.   3.49 in.   59 56  4.10 in.   4.83 in. 15 16  3.21 in.   3.65 in.   60 57  1.57 in.   1.57 in. 16 18  2.95 in.   3.80 in.   61 57  2.03 in.   2.78 in. 17 19  2.92 in.   3.83 in.   62 57  4.12 in.   4.83 in. 18 19  7.61 in.   7.61 in.   63 58  1.57 in.   1.57 in. 19 20  2.83 in.   3.93 in.   64 58  2.01 in.   2.73 in. 20 20  7.61 in.   7.61 in.   65 58  4.18 in.   4.86 in.

 

 

 

 

 

 

 

Thanks for all your help!

 

 

 

 

post-133291-0-46388900-1443819985_thumb.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...