Skip to content

The nfp image hand-painted in the game cannot be converted into a png image #4

@SvCpu

Description

@SvCpu

Hello, I am the cc:restitched mod (A derivative of the computercraft mod) users

I used your project to try to convert the in-game hand-drawn nfp (called nft in the cc: restitched mod) to a png image and failed
After researching, I found out the reason. The reason is that the pixels that are not painted in the game will be stored as spaces or the entire line is blank in the nft, so that these transparent colors cannot be displayed when the nft image is converted in your program. Converting to RGB colors will cause the sequence of images to be of different lengths, which will cause PIL to fail to store the image and report an error.

I added the standardize(nfp) function in your code nfp.py
This function will format the incoming nfp string.

  • Fill the number of words in each line with the number of words in the longest line in the nft file
  • spaces will be replaced with 0 (white)

Please consider adding this function to your project if you can.
nfp.txt

The above content was translated using Google Translate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions