Comments (3)
@greenseeker I'm taking a guess here, but I believe the error occurs because you're redirecting stdout
to a file. The tool detects terminal size from stdout
every time, which is usually the terminal, so I can see how that's an issue. Custom dimensions also won't work since they check whether the width exceeds the terminal (stdout
again) as well.
I wanted to keep the flags simple for most users so I'm not sure about adding character encoding functionality, because then covering only ANSI characters set would seem inappropriate. For the time being, I believe you can change the saved text file encoding with CLI tools like iconv
or recode
.
Will have to think about this. Thanks for pointing out the issue though, I'm a bit busy these days but I'll try to make a fix soon.
from ascii-image-converter.
I suspected the same regarding the crash/failure when redirecting output.
You're already encoding it in ansi to write to the screen; I was just looking for a nice way to save that to a file as well. If you were to do so, optimizing the escape codes would be nice also. At the moment, the color is being reset to defaults and then set to the new color in between every character, even if that character is the same color as the previous one.
from ascii-image-converter.
@greenseeker Released the patched version 1.3.4. Wrote some conditions where terminal size will be calculated through stdin
if stdout
is redirected somewhere. This could be potentially breaking for library usage without CLI but I'll look into it later. Pipes with commands like grep
should now work too. This patch isn't available for windows yet since I'm still figuring that out.
Optimizing escape codes seems like a good idea, but I don't think it'll be very effective overall. You see, I'm encoding each character with RGB values, which are not usually the same for two adjacent ascii characters. At best, for usual images, you'd find 2 or 3 characters with the same color codes adjacent to each other. I could optimize it a little bit but it seems overkill for not enough benefit. Let me know if I'm missing something here.
I believe this issue is resolved now so I'm closing it :)
from ascii-image-converter.
Related Issues (20)
- wow, is great HOT 1
- panic: runtime error: index out of range [0] with length 0 HOT 13
- Q. Debian packaging and/or launchpad? HOT 1
- Docker image HOT 2
- Brew deprecated arguments HOT 2
- ascii-image-converter command not working on macOS Monterey HOT 1
- --color-bg is not being applied when saving to a file HOT 1
- Clear ansi-colored output HOT 1
- Files in any format cannot be saved on the windows 10
- Feature Request: bin piping support HOT 5
- The saved ascii art in txt, is not working properly HOT 3
- more color format of output HOT 2
- Unable to only save with color using go library HOT 1
- Save animated gif HOT 1
- Add ability to convert any io.Reader (or maybe any image.Image) to aic_package HOT 1
- `Fetching file from url...` gets sent through pipes, even though it doesn't normally
- Can't convert: Unable to open file: img.png No such file or directory
- Phone portrait mode photos are rotated by 90° HOT 1
- Feature request to export colored ascii art directly to neofetch
- No option to save with color? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ascii-image-converter.