qeesung / image2ascii

:foggy: Convert image to ASCII
MIT License
890 stars 78 forks source link

Add an option to save the result #21

Open oyedejioyewole opened 2 years ago

oyedejioyewole commented 2 years ago

Please could you add the feature of saving the result of the image2ascii to a file. Doing this manually doesn't work as you use some kind of terminal color formatting, which makes the result in a file look ugly.

Thanks

nicobleiler commented 1 year ago

@OyewoleOyedeji how do you even get pipe output to work? When I try I just get NIL?

image2ascii -f frame_000.png -s -c=false > 0.txt
2023/10/28 18:25:14 <nil>
muradbu commented 1 year ago

I'm in the same boat now

image2ascii -f frame_000_delay-0.05s.jpg > out.txt
2023/11/10 13:16:12 <nil>
muradbu commented 1 year ago

I figured out it's due to the default options of the image dimensions.

type Options struct {
    Ratio           float64
    FixedWidth      int
    FixedHeight     int
    FitScreen       bool // only work on terminal
    StretchedScreen bool // only work on terminal
    Colored         bool // only work on terminal
    Reversed        bool
}

Specify a fixed width, height or ratio to make it work.