← Back to team overview

kicad-developers team mailing list archive

Re: How to make single-plane .cpp from .png?

 

Thanks Nick, that made the resulting cpp files even smaller thanks to
pngcrush!

On 6/08/19 9:15 PM, Nick Østergaard wrote:
> Maybe I am off here, butnis there any reason why you can just enable
> the MAINTAIN_PNGS option to make it convert the svg to cpp?
>
> tir. 6. aug. 2019 06.01 skrev Johannes Sprigode <jos@xxxxxxxxxxx
> <mailto:jos@xxxxxxxxxxx>>:
>
>     If I may chip in.
>
>     The new symbols (16x16) I created for the horizontal text are done in
>     inkscape and exported as png.
>
>     Post processed in gimp to an 8-bit grey scale with alpha which reduced
>     them from ~300 to ~170 something bytes.
>
>     They still appear to have the same quality as you have seen. Settings
>     attached.
>
>     The same should be doable for those cursors, or anything alike.
>
>     Cheers
>
>     Johannes
>
>     On 6/08/19 9:51 AM, Jeff Young wrote:
>     > If you open the PNG in Gimp and then export as XBM it works. 
>     (Note that while wxBitmap’s constructor purports to support sizes,
>     if you pass anything under 32x32 you’ll get garbage.)
>     >
>     > However, the cursors aren’t greyscale (they’re true
>     black-and-white), so the whole SVG source idea produces some
>     pretty ugly cursors.  I think we’ll have to specify them as bitmaps.
>     >
>     >> On 5 Aug 2019, at 15:25, Jeff Young <jeff@xxxxxxxxx
>     <mailto:jeff@xxxxxxxxx>> wrote:
>     >>
>     >> I also tried online converters for PNG -> XBM and directly from
>     the source (SVG -> XBM), but they all give me black images….
>     >>
>     >>
>     >>> On 5 Aug 2019, at 15:15, Jeff Young <jeff@xxxxxxxxx
>     <mailto:jeff@xxxxxxxxx>> wrote:
>     >>>
>     >>> I found doc on the colour modes; 0 is monochrome without
>     alpha, 2 is RGB, 4 is monochrome with alpha and 6 is RGBA.
>     >>>
>     >>> So -c 0 should be correct. 
>     >>>
>     >>> But it appears wxBitmap is expecting XBM data rather than PNG
>     data.  Hm…..
>     >>>
>     >>>
>     >>>> On 5 Aug 2019, at 14:46, Jeff Young <jeff@xxxxxxxxx
>     <mailto:jeff@xxxxxxxxx>> wrote:
>     >>>>
>     >>>> pngcrush -c 0 makes a single-plane char array, but it appears
>     to be in a different order or something (the array is the right
>     size, but produces a garbage cursor).
>     >>>>
>     >>>> Anyone know what the other colour modes are?  (0, 2, 4, 6)
>     >>>>
>     >>>>> On 5 Aug 2019, at 13:22, Jeff Young <jeff@xxxxxxxxx
>     <mailto:jeff@xxxxxxxxx>> wrote:
>     >>>>>
>     >>>>> Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour)
>     char array.
>     >>>>>
>     >>>>> wxWidgets’ wxBitmap() constructor needs a single plane char
>     array.  John Beard created a couple for the SPICE cursors, but I’m
>     not sure how he did it.
>     >>>>>
>     >>>>> Thanks,
>     >>>>> Jeff.
>     >>>>>
>     >>>>>
>     >>>>> _______________________________________________
>     >>>>> Mailing list: https://launchpad.net/~kicad-developers
>     >>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>     >>>>> More help   : https://help.launchpad.net/ListHelp
>     >>>>
>     >>>> _______________________________________________
>     >>>> Mailing list: https://launchpad.net/~kicad-developers
>     >>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >>>> Unsubscribe : https://launchpad.net/~kicad-developers
>     >>>> More help   : https://help.launchpad.net/ListHelp
>     >>>
>     >>> _______________________________________________
>     >>> Mailing list: https://launchpad.net/~kicad-developers
>     >>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >>> Unsubscribe : https://launchpad.net/~kicad-developers
>     >>> More help   : https://help.launchpad.net/ListHelp
>     >>
>     >> _______________________________________________
>     >> Mailing list: https://launchpad.net/~kicad-developers
>     >> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     >> Unsubscribe : https://launchpad.net/~kicad-developers
>     >> More help   : https://help.launchpad.net/ListHelp
>     >
>     > _______________________________________________
>     > Mailing list: https://launchpad.net/~kicad-developers
>     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     > Unsubscribe : https://launchpad.net/~kicad-developers
>     > More help   : https://help.launchpad.net/ListHelp
>     _______________________________________________
>     Mailing list: https://launchpad.net/~kicad-developers
>     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     Unsubscribe : https://launchpad.net/~kicad-developers
>     More help   : https://help.launchpad.net/ListHelp
>

Attachment: signature.asc
Description: OpenPGP digital signature


References