On a black and white image, is there a way to calculate how much black and how much white is used?

On a black and white image, is there a way to calculate how much black and how much white is used?

  • Are you talking about the DMAX of the darkest area or what percentage of the area is covered in black?

    • Hi David, thanks for getting back to me. I'm creating an electrical circuit for printing using conductive ink. The circuit is created in black on a white background. I need to work out how much conductive ink will be needed to print the circuit.

      • Sorry, I'm needing the answer in square mm.

        • Yes, with a macro. I have a simple one that gives area of shape in sq mm. 

          • Hi Myron, sounds good, are you able to share? I'm not familiar with macros so would also need some help with that.

            • There you go Myron has a simple solution like

              • Sub AreaOfShapeMM()
                ActiveDocument.Unit = cdrMillimeter
                MsgBox Round(ActiveShape.DisplayCurve.Area, 2) & " Sq mm"
                End Sub

                1. Open Macro Manager docker (Alt+shift+F11) or Windows/Dockers/Macro Manager
                2. Right-click on Visual Basic for Applications & choose
                New Macro Project.
                3. Name the file with no spaces i.e. AreaOfShapeMM to
                C:\Users\Myron\AppData\Roaming\Corel\CorelDRAW Graphics Suite X7\Draw\GMS
                Hit Save.
                4. You’ll see it pop up at the bottom of the Macro Manager list, click off off it
                then right click and choose New Module.
                5. Click off the the New Module then right-click on it and choose New Macro
                6. Copy/paste all code given over the “Sub Macro1() End Sub”
                7. Select a shape then double-click the macro
                8. Now you can assign a keyboard shortcut of your choosing to it. Right-click on the macro
                from the Macro Manager and choose Assign Keyboard Shortcut.
                9. type the shortcut you want in and hit assign.

                • Hi Myron,

                  Thank you.

                  I've done that, not sure if it is working, where do I see my results, do I need to open something?

              • I think they may be misinterpreting your question here, or maybe I am?

                You have a black and white image and want to know how many pixels are black and how many white,
                and then you want to know how much that is in square millimeters, right?

                Not sure I can help you all the way but here is an online calculator to count the number of pixels for each color.
                But since a pixel doesn't really have a specific size, you have to manually calculate how much that is in sq mm,
                based on the size of the image and its resolution in pixels per mm.

                • Hi Ronny. Number of pixels of each colour as per your calculator, then calculate the percentage black. Then for the image calculate the physical size when placed as mm² and then apply the percentage. Important to measure the image physical size at print resolution.

                • Sub bhbp_Black_White_Area
                  'WE MUST HAVE ONLY BLACK AND WHITE FILLED SHAPES
                  'RGB COLOR PALETTE
                  ActiveDocument.Unit = cdrMillimeter

                  For Each bhbp_shape In ActiveDocument.ActivePage.Shapes
                  If bhbp_shape.Fill.UniformColor.RGBRed = 0 Then 'And bhbp_shape.Fill.UniformColor.RGBGreen = 0 And bhbp_shape.Fill.UniformColor.RGBBlue = 0 Then 'white fill
                  BhBp_Area_white = BhBp_Area_white + Round(bhbp_shape.DisplayCurve.Area, 2)
                  End If

                  If bhbp_shape.Fill.UniformColor.RGBRed = 255 And bhbp_shape.Fill.UniformColor.RGBGreen = 255 And bhbp_shape.Fill.UniformColor.RGBBlue = 255 Then 'black fill
                  BhBp_Area_black = BhBp_Area_black + Round(bhbp_shape.DisplayCurve.Area, 2)
                  End If

                  BhBp_Area = BhBp_Area + Round(bhbp_shape.DisplayCurve.Area, 2)
                  Next

                  MsgBox BhBp_Area & " mm2 IS AREA OF ALL SHAPES" & Chr(13) & BhBp_Area_white & " mm2 IS AREA OF WHITE SHAPES" & Chr(13) & BhBp_Area_black & " mm2 IS AREA OF BLACK SHAPES"

                  End Sub