Home > Blockchain >  Making an image out of a string in python
Making an image out of a string in python

Time:10-07

I remember seeing a tutorial on OpenCV on making an imagine out of a multiline string.

Example :

"""
001000000
001000000
001000000
001000000
001000000
001000000
"""

That would produce a black pixel for every 0 in the string, and a white pixel for the 1s.

like that

Please tell me if I can give you more information!

CodePudding user response:

Put a enter image description here


Enlarge it to 100 pixels wide, invert and convert to PNG with ImageMagick like this:

magick image.pbm -negate -scale 100x result.png
  • Related