Counting Pixels

Discussion in 'NZ Computing' started by Lindsay.Rollo@paradisedotnetdotnz, Dec 4, 2009.

  1. Is there a simple way to determine the number of black pixels in
    a specimen text block?

    I want to compare the differences in the number of pixels used to
    display the specimen text block in different type faces.
    Lindsay.Rollo@paradisedotnetdotnz, Dec 4, 2009
    #1
    1. Advertising

  2. In message <>,
    Lindsay.Rollo@paradisedotnetdotnz wrote:

    > Is there a simple way to determine the number of black pixels in
    > a specimen text block?


    render(the_text, pixbuf);
    nrblack = 0;
    for (row = rowmin; row < rowmax; ++row)
    {
    for (col = colmin ; col < colmax; ++co)
    {
    if (getpixel(pixbuf, row, col) == black)
    {
    ++nrblack;
    } /*if*/
    } /*for*/
    } /*for*/
    Lawrence D'Oliveiro, Dec 4, 2009
    #2
    1. Advertising

  3. I was hoping someone woul;d know a readily available program that
    would give me the answer, as I'm not a programmer.
    Lindsay.Rollo@paradisedotnetdotnz, Dec 4, 2009
    #3
  4. Lindsay.Rollo@paradisedotnetdotnz

    Craig Sutton Guest

    "Lawrence D'Oliveiro" <_zealand> wrote in message
    news:hfack1$5oq$...
    > In message <>,
    > Lindsay.Rollo@paradisedotnetdotnz wrote:
    >
    >> Is there a simple way to determine the number of black pixels in
    >> a specimen text block?

    >
    > render(the_text, pixbuf);
    > nrblack = 0;
    > for (row = rowmin; row < rowmax; ++row)
    > {
    > for (col = colmin ; col < colmax; ++co)
    > {
    > if (getpixel(pixbuf, row, col) == black)
    > {
    > ++nrblack;
    > } /*if*/
    > } /*for*/
    > } /*for*/
    >


    NERD for knowing that
    Craig Sutton, Dec 4, 2009
    #4
  5. In message <hfapif$dq5$>, Craig Sutton wrote:

    > "Lawrence D'Oliveiro" <_zealand> wrote in message
    > news:hfack1$5oq$...
    >
    >> In message <>,
    >> Lindsay.Rollo@paradisedotnetdotnz wrote:
    >>
    >>> Is there a simple way to determine the number of black pixels in
    >>> a specimen text block?

    >>
    >> render(the_text, pixbuf);
    >> nrblack = 0;
    >> for (row = rowmin; row < rowmax; ++row)
    >> {
    >> for (col = colmin ; col < colmax; ++co)
    >> {
    >> if (getpixel(pixbuf, row, col) == black)
    >> {
    >> ++nrblack;
    >> } /*if*/
    >> } /*for*/
    >> } /*for*/
    >>

    >
    > NERD for knowing that


    That’s right, I forgot this is actually nz.knitting. My abject apologies for
    posting something related to how you actually use computers.
    Lawrence D'Oliveiro, Dec 4, 2009
    #5
  6. In message <>,
    Lindsay.Rollo@paradisedotnetdotnz wrote:

    > I was hoping someone woul;d know a readily available program that
    > would give me the answer, as I'm not a programmer.


    Hire a programmer, then.
    Lawrence D'Oliveiro, Dec 4, 2009
    #6
  7. Lindsay.Rollo@paradisedotnetdotnz

    Me Guest

    Lawrence D'Oliveiro wrote:
    > In message <>,
    > Lindsay.Rollo@paradisedotnetdotnz wrote:
    >
    >> I was hoping someone woul;d know a readily available program that
    >> would give me the answer, as I'm not a programmer.

    >
    > Hire a programmer, then.
    >

    If the OP wants a windows executable to do the job, post again here and
    I'll make one for free and upload it.
    It will take little time to do, yet be more productive than Larry D'O's
    entire career on usenet.
    Me, Dec 6, 2009
    #7
  8. Me <>::

    >If the OP wants a windows executable to do the job, post again here and
    >I'll make one for free and upload it.


    Thank you for your offer, which I accept.

    You could attach the executable to an email to



    I'm primarily interested in counting black pixels, but can you
    will make provision for counting any color?

    Cheers
    Lindsay.Rollo@paradisedotnetdotnz, Dec 6, 2009
    #8
  9. Lindsay.Rollo@paradisedotnetdotnz

    Me Guest

    Lindsay.Rollo@paradisedotnetdotnz wrote:
    > Me <>::
    >
    >> If the OP wants a windows executable to do the job, post again here and
    >> I'll make one for free and upload it.

    >
    > Thank you for your offer, which I accept.
    >
    > You could attach the executable to an email to
    >
    >
    >
    > I'm primarily interested in counting black pixels, but can you
    > will make provision for counting any color?
    >

    Just emailed it to you, exe file in a zip, about 215kb.
    Very basic rough & ready, but works okay. To use, open a bitmap file by
    clicking "Open bmp file..." button.
    (not sure how you wanted to do it, but loading image as bitmap was
    simplest, so you might need to save your image as a bitmap first)
    Default colour of pixels to count is black, result displayed when file
    loaded.
    Click anywhere on displayed bitmap image to select a different colour to
    "count pixels", and show result.
    Me, Dec 6, 2009
    #9
  10. Lindsay.Rollo@paradisedotnetdotnz

    Me Guest

    Me wrote:
    > Lindsay.Rollo@paradisedotnetdotnz wrote:
    >> Me <>::
    >>
    >>> If the OP wants a windows executable to do the job, post again here
    >>> and I'll make one for free and upload it.

    >>
    >> Thank you for your offer, which I accept.
    >>
    >> You could attach the executable to an email to
    >>
    >>
    >>
    >> I'm primarily interested in counting black pixels, but can you
    >> will make provision for counting any color?
    >>

    > Just emailed it to you, exe file in a zip, about 215kb.
    > Very basic rough & ready, but works okay. To use, open a bitmap file by
    > clicking "Open bmp file..." button.
    > (not sure how you wanted to do it, but loading image as bitmap was
    > simplest, so you might need to save your image as a bitmap first)
    > Default colour of pixels to count is black, result displayed when file
    > loaded.
    > Click anywhere on displayed bitmap image to select a different colour to
    > "count pixels", and show result.



    Your email bounced the attached zip file. Have uploaded to server and
    sent you a link to download it.
    Cheers.
    Me, Dec 7, 2009
    #10
  11. In message <>,
    Lindsay.Rollo@paradisedotnetdotnz wrote:

    > Thank you for your offer, which I accept.
    >
    > You could attach the executable to an email to


    Ah, the old accept-executables-from-dubious-sources-on-the-Internet trick.
    Works every time.
    Lawrence D'Oliveiro, Dec 7, 2009
    #11
  12. Lindsay.Rollo@paradisedotnetdotnz

    Me Guest

    Lawrence D'Oliveiro wrote:
    > In message <>,
    > Lindsay.Rollo@paradisedotnetdotnz wrote:
    >
    >> Thank you for your offer, which I accept.
    >>
    >> You could attach the executable to an email to

    >
    > Ah, the old accept-executables-from-dubious-sources-on-the-Internet trick.
    > Works every time.
    >

    I've supplied my real email address to him, as well as the URL to my
    site that I've uploaded the file to, so do you still really think that
    I'd send malware/trojan/virus infected code?

    The only malicious thing in this thread so far has been your presence.
    And no, I didn't use your code. If the OP wants my code to compile it
    himself, he's welcome. You're not.
    Me, Dec 7, 2009
    #12
  13. Attention Me.

    Your program achieved exactly the result I needed.

    Using a word processor a test text was displayed in an otherwise
    blank page, re-formatted in each type face, then a ‘Print Screen' dump
    pasted into an image editor. Each pasted image was then cropped and
    saved.

    Black pixels were counted with PixelCounter.exe.

    By adopting one value as the benchmark, and dividing all the
    pixel values by the benchmark value, the process provides a direct
    comparison of the relative density of black text in the test fonts.

    This information is one element of making rational choices about
    which type faces are more likely to be most legible in web pages.

    Me, could you now sent a message to as to you
    intentions about copywrite, permission to share the executable with
    third parties, etc. It would be helpful also if I could give credit to
    a real person rather than a non-de-plume.

    Tks again for facilitating this simple piece of research.
    Lindsay.Rollo@paradisedotnetdotnz, Dec 7, 2009
    #13
  14. Lindsay.Rollo@paradisedotnetdotnz

    Me Guest

    Lindsay.Rollo@paradisedotnetdotnz wrote:
    > Attention Me.
    >
    > Your program achieved exactly the result I needed.
    >
    > Using a word processor a test text was displayed in an otherwise
    > blank page, re-formatted in each type face, then a ‘Print Screen' dump
    > pasted into an image editor. Each pasted image was then cropped and
    > saved.
    >
    > Black pixels were counted with PixelCounter.exe.
    >
    > By adopting one value as the benchmark, and dividing all the
    > pixel values by the benchmark value, the process provides a direct
    > comparison of the relative density of black text in the test fonts.
    >
    > This information is one element of making rational choices about
    > which type faces are more likely to be most legible in web pages.
    >
    > Me, could you now sent a message to as to you
    > intentions about copywrite, permission to share the executable with
    > third parties, etc. It would be helpful also if I could give credit to
    > a real person rather than a non-de-plume.
    >
    > Tks again for facilitating this simple piece of research.


    Glad it worked!
    As I said I'd do it for free, it's free, so I don't need credit, use and
    distribute freely "as-is" without restriction.
    It took a few minutes only to write and compile using a shareware
    version of Delphi - a good old program for that sort of thing.
    Me, Dec 7, 2009
    #14
  15. In message <hfi4ic$b8$>, Me wrote:

    > Lawrence D'Oliveiro wrote:
    >
    >> In message <>,
    >> Lindsay.Rollo@paradisedotnetdotnz wrote:
    >>
    >>> Thank you for your offer, which I accept.
    >>>
    >>> You could attach the executable to an email to

    >>
    >> Ah, the old accept-executables-from-dubious-sources-on-the-Internet
    >> trick. Works every time.

    >
    > The only malicious thing in this thread so far has been your presence.


    Interesting that I didn’t use the word “maliciousâ€, yet you immediately
    jumped to that conclusion. Says something about your thought processes,
    doesn’t it?
    Lawrence D'Oliveiro, Dec 7, 2009
    #15
  16. Lindsay.Rollo@paradisedotnetdotnz

    JohnO Guest

    On Dec 7, 10:44 pm, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:
    > In message <hfi4ic$>, Me wrote:
    >
    > > Lawrence D'Oliveiro wrote:

    >
    > >> In message <>,
    > >> Lindsay.Rollo@paradisedotnetdotnz wrote:

    >
    > >>> Thank you for your offer, which I accept.

    >
    > >>> You could attach the executable to an email to

    >
    > >> Ah, the old accept-executables-from-dubious-sources-on-the-Internet
    > >> trick. Works every time.

    >
    > > The only malicious thing in this thread so far has been your presence.

    >
    > Interesting that I didn’t use the word “malicious”, yet you immediately
    > jumped to that conclusion. Says something about your thought processes,
    > doesn’t it?


    Yes, it shows his thought processes - both in reading your
    insinuation, and in his appraisal of your general worth in this forum,
    were bang on.

    What else would 'works every time' mean, Larry? Don't answer, it's a
    hypothetical question.

    You really are a waste of space, Larry.
    JohnO, Dec 7, 2009
    #16
  17. In message <81e661f2-61e8-4679-
    >, JohnO wrote:

    > You really are a waste of space, Larry.


    When have you actually contributed anything of value to nz.comp? It seems to
    me the sum total of your postings is sniping at the comments of others. Do
    you actually have any computer knowledge at all?
    Lawrence D'Oliveiro, Dec 7, 2009
    #17
  18. Lindsay.Rollo@paradisedotnetdotnz

    JohnO Guest

    On Dec 8, 12:13 pm, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:
    > In message <81e661f2-61e8-4679-
    >
    > >, JohnO wrote:
    > > You really are a waste of space, Larry.

    >
    > When have you actually contributed anything of value to nz.comp? It seems to
    > me the sum total of your postings is sniping at the comments of others. Do
    > you actually have any computer knowledge at all?


    You seem to confuse not posting steaming mountains of crap with a lack
    of computer knowledge.

    You need to get out more, Larry.
    JohnO, Dec 8, 2009
    #18
  19. Lindsay.Rollo@paradisedotnetdotnz

    Sailor Sam Guest

    JohnO wrote:
    > On Dec 8, 12:13 pm, Lawrence D'Oliveiro <l...@geek-
    > central.gen.new_zealand> wrote:
    >> In message <81e661f2-61e8-4679-
    >>
    >> >, JohnO wrote:
    >>> You really are a waste of space, Larry.

    >> When have you actually contributed anything of value to nz.comp? It seems to
    >> me the sum total of your postings is sniping at the comments of others. Do
    >> you actually have any computer knowledge at all?

    >
    > You seem to confuse not posting steaming mountains of crap with a lack
    > of computer knowledge.
    >
    > You need to get out more, Larry.


    I'm curious as well, I would have to say my observations correlate with
    what Lawrence has said.

    Also, in nz.general, you claimed that a lack of postings on a point
    proved that point.

    /me shrugs, which was is it?
    Sailor Sam, Dec 8, 2009
    #19
  20. Lindsay.Rollo@paradisedotnetdotnz

    Sailor Sam Guest

    Sailor Sam wrote:
    > JohnO wrote:
    >> On Dec 8, 12:13 pm, Lawrence D'Oliveiro <l...@geek-
    >> central.gen.new_zealand> wrote:
    >>> In message <81e661f2-61e8-4679-
    >>>
    >>> >, JohnO wrote:
    >>>> You really are a waste of space, Larry.
    >>> When have you actually contributed anything of value to nz.comp? It
    >>> seems to
    >>> me the sum total of your postings is sniping at the comments of
    >>> others. Do
    >>> you actually have any computer knowledge at all?

    >>
    >> You seem to confuse not posting steaming mountains of crap with a lack
    >> of computer knowledge.
    >>
    >> You need to get out more, Larry.

    >
    > I'm curious as well, I would have to say my observations correlate with
    > what Lawrence has said.
    >
    > Also, in nz.general, you claimed that a lack of postings on a point
    > proved that point.
    >
    > /me shrugs, which was is it?


    er, way.
    Sailor Sam, Dec 8, 2009
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Grady
    Replies:
    10
    Views:
    852
  2. notreallyme
    Replies:
    14
    Views:
    944
  3. kl_tom

    Can hot pixels become dead pixels?

    kl_tom, Oct 4, 2006, in forum: Digital Photography
    Replies:
    4
    Views:
    508
    Bill Funk
    Oct 5, 2006
  4. Enkidu

    Re: counting pixels

    Enkidu, Aug 9, 2008, in forum: NZ Computing
    Replies:
    0
    Views:
    479
    Enkidu
    Aug 9, 2008
  5. Jasen Betts

    Re: counting pixels

    Jasen Betts, Aug 9, 2008, in forum: NZ Computing
    Replies:
    0
    Views:
    355
    Jasen Betts
    Aug 9, 2008
Loading...

Share This Page