Jump to content


Photo

Counting filled cells in column


34 replies to this topic

#1 teferrell

teferrell
  • Newbies
  • 3 posts
  • Reputation:0

Posted 15 August 2013 - 01:23 AM

I have a method for converting a black and white image into instructions for folding a book into the image (method is here http://www.instructa...ok-into-a-Word/).  To do this I count filled pixels by column if a zoomed in image.  Is there a way to generate a count of filled and unfilled spaces in an image.  This would speed up one of the more tedious parts of the process.  Thank you for any help.


  • 0

#2 pdnnoob

pdnnoob

    2013 Radiance Award Winner

  • Moderators
  • 2,406 posts
  • Reputation:192

Posted 15 August 2013 - 02:11 AM

The fastest way I can think of for doing this is to zoom in and select the column with the magic wand tool and look at the info bar at the bottom to see how tall the selection is.
  • 0
noobsig-1.png
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

#3 teferrell

teferrell
  • Newbies
  • 3 posts
  • Reputation:0

Posted 15 August 2013 - 03:00 AM

That is basically what I do, however with over 100 columns it takes a while.  I note the beginning and end of the filled (black), or beginning and length.  Was hoping for a way to generate the count automatically.


  • 0

#4 TechnoRobbo

TechnoRobbo

    2013 Plugin of the Year Author

  • Members
  • 887 posts
  • LocationIllinois
  • Reputation:436

Posted 15 August 2013 - 02:17 PM

Hi,

 

attached is a plugin called PixelCounter - install it as you would any plugin- it will appear under the effects.

Create a folder under the C:\ root folder called "count" just lowercase "count"

 

Make your black and white text, hit escape, run PixelCounter (again it's under effects, at the bottom)

 

press ok.

 

look under the C:\count folder and you'll find a file called "pixelcount". open it with Notepad.

 

I've attached an example of the word "Test"

 

The Plugin considers anything that's not white a pixel so you may want to turn off anti-aliasing.

 

Also you can use it to make images in the books. Just a thought.

Attached Files


Edited by TechnoRobbo, 15 August 2013 - 03:18 PM.

  • 0

#5 teferrell

teferrell
  • Newbies
  • 3 posts
  • Reputation:0

Posted 16 August 2013 - 01:40 AM

A million thanks, that is exactly what I needed!


  • 0

#6 TechnoRobbo

TechnoRobbo

    2013 Plugin of the Year Author

  • Members
  • 887 posts
  • LocationIllinois
  • Reputation:436

Posted 16 August 2013 - 02:04 AM

cool

 

for any programmer out there curious about the code:

Hidden Content:


Edited by TechnoRobbo, 16 August 2013 - 02:06 AM.

  • 0

#7 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 21 November 2013 - 08:41 PM

I installed the pixelcounter plugin and used it under the effects however when I look in the "count" folder I made in the c:/program files/paintnet folder I cant find the txt file.  the count folder is empty.  I even ran a search for a pixelcount.txt or anything pixelcount and find nothing.  Can you help?  Thanks!  I am using Windows 7.


  • 0

#8 Ego Eram Reputo

Ego Eram Reputo

    2013 Proton Award Winner

  • Moderators
  • 7,813 posts
  • LocationNorth Canterbury, New Zealand
  • Reputation:612

Posted 21 November 2013 - 09:16 PM

You made the folder in the wrong location. You need it to be in this location C:/count/

See TechnoRobbo's post above where he says:
 

Create a folder under the C:\ root folder called "count" just lowercase "count"


  • 1

#9 TechnoRobbo

TechnoRobbo

    2013 Plugin of the Year Author

  • Members
  • 887 posts
  • LocationIllinois
  • Reputation:436

Posted 22 November 2013 - 11:39 AM

Ego is correct. This plugin was written to quickly help teferrell, I found his instructable very fascinating.

I didn't flesh it out for general use because I didn't think it would have that many uses.

 

Thanks EER


  • 0

#10 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 27 November 2013 - 09:11 PM

thanks!


  • 0

#11 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 28 November 2013 - 02:23 PM

got it working...thanks!  Now can I ask for help in using it?  Sorry to be so tech illiterate.  I found the pixel count text and see that it shows the beginning and length in pixels.  How do I then understand this in terms of centimeters to use as my word template? Does each pixel stand for a centimeter?  Or when the text says column 295 top 456 length 12......top starts at 4.5 cent and is 12 cent long?


  • 0

#12 TechnoRobbo

TechnoRobbo

    2013 Plugin of the Year Author

  • Members
  • 887 posts
  • LocationIllinois
  • Reputation:436

Posted 28 November 2013 - 03:54 PM

Gosh I've never folded a book, but from the Instructables by TeFrerrel...

 

http://www.instructa...ok-into-a-Word/

 

I see he uses a scale of 10 per pixel inch (2.53 cm).

 

I'm confused as to how one could use Word since one would have to wrestle with the kerning and justification.

 

Pixel Primer

The output file is in pixels (Picture Elements). On a computer graphic pixels are arranged in columns and rows like an Excel spreadsheet cell. Different font sizes achieve a different pixel count.

 

countexample.PNG

 

The output file tells you the pixel location in the the terms of  how many rows from the top and how many columns from the left margin. The length is how far to the right of that location the pixel extends.

 

 

 

I think TeFerrel scales depending on the dimensions of the book (or the number of pages). The word "Love" would require much less pixels for a paperback novel than it would in the monstrous textbook TeFerrel used.  My "test" example is only 12 pixels wide. If the book has is 2 inches wide then  I assume 6 pixels per inch (2 pixels per cm) or less is appropriate..


Edited by TechnoRobbo, 28 November 2013 - 03:59 PM.

  • 0

#13 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 16 January 2014 - 08:25 PM

The pixel count worked great on my first try but recently when using it there are some problems.  around column 40 the count is waaaay off, like 24 pixels longer than it should be.  When checking back to the image in paintnet, the image looks correct and I have no idea why it would do this.  I am deleting the plugin and reinstalling to see if that helps.  Anyone else have this problem?


  • 0

#14 TechnoRobbo

TechnoRobbo

    2013 Plugin of the Year Author

  • Members
  • 887 posts
  • LocationIllinois
  • Reputation:436

Posted 16 January 2014 - 08:39 PM

if you can post the image maybe I can help


  • 0

#15 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 13 February 2014 - 08:46 PM

I am hoping someone can pinpoint a problem I am having with the pixelcount plugin.  If I have multiple layers it seems to create problems with the count.  Also I recently imported an image and after preparing it and running the pixelcount plugin it ignored pixels that were in the lower half of the image.  If someone can help with this I can email the pdn file since I can't figure out how to attach it here.  Thanks!


  • 0

#16 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 14 February 2014 - 10:49 PM

I am having trouble with the pixelcounter plugin and after posting under the topic "counting filled cells" and not getting responses and asking for help in the facebook group I was advised to post here.

Normally when running the plugin after using only text I have no problem however when importing an image (in this case the map of Michigan) the pixelcounter ignored the lower half of the pixels in the image.  I am hoping someone might be able to explain why.....maybe the creator of the plugin?

 

I cant upload the pdn file here but I have attached the pixelcount text as well as the original image used.  I have also attached an example of the folded books.  Thanks!

Attached Thumbnails

  • michigan.jpg
  • heart note book.jpg

Attached Files


  • 0

#17 Ego Eram Reputo

Ego Eram Reputo

    2013 Proton Award Winner

  • Moderators
  • 7,813 posts
  • LocationNorth Canterbury, New Zealand
  • Reputation:612

Posted 15 February 2014 - 02:50 AM

I've merged these threads together to keep this discussion in one place.

I'm sure TechnoRobbo will be along shortly to give you some guidance :)
  • 0

#18 TechnoRobbo

TechnoRobbo

    2013 Plugin of the Year Author

  • Members
  • 887 posts
  • LocationIllinois
  • Reputation:436

Posted 15 February 2014 - 10:50 PM

I'm sorry I've been extremely busy. I'll have a look.

 

pixelcounter relies on white bordering the image - Go to the image menu - select canvas size,  add 2 pixels to the height and width, anchor in the middle and everything will workout fine.

post-105131-0-43154100-1392506989.png

 

 

Attached Thumbnails

  • Capture.PNG

Edited by TechnoRobbo, 15 February 2014 - 11:32 PM.

  • 0

#19 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 16 February 2014 - 01:09 AM

Thanks so much! I'll give it a try when I get home from our weekend trip :)
  • 0

#20 heathersharmony

heathersharmony
  • Members
  • 15 posts
  • Reputation:3

Posted 17 February 2014 - 11:05 PM

Are you adding the 2 pixels in the Print size area where it shows 1.02 inches and 1.04?


  • 0