Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Converts videos, images, gifs, and even live video into ascii art!
[DEMO SITE] [Video Example] [Video Example 2]
Via pip:
pip install to-ascii[speedups,cli]
speedups
extra is recommended, see belowcli
extra is required for CLI use (it adds click as a dependency)Usage: toascii [OPTIONS] {image|video} SOURCE {colorconverter|colorconverternim|grayscaleconverter|grayscaleconverternim|htmlcolorconverter|htmlcolorconverternim}
Options:
-g, --gradient TEXT
-w, --width INTEGER RANGE [x>=1]
-h, --height INTEGER RANGE [x>=1]
--x-stretch, --xstretch FLOAT RANGE
[x>0.0]
--y-stretch, --ystretch FLOAT RANGE
[x>0.0]
--saturation FLOAT RANGE [-1.0<=x<=1.0]
--contrast FLOAT RANGE [0.0<=x<=1.0]
--blur INTEGER RANGE [x>=2]
--loop
--help Show this message and exit.
# live video
toascii video 0 colorconverternim -h 103 --x-stretch 3.5 --blur 10 --contrast 0.01 --saturation 0.0
toascii image sammie.jpg grayscaleconverter -h 32 --x-stretch 2.1 --blur 20 --contrast 0.0 --saturation 0.0
toascii video IMG_7845.MOV colorconverternim -h 81 --x-stretch 2.5 --blur 15 --contrast 0.01 --saturation 0.0 --loop
ConverterOptions
(*, gradient
: str
, width
: Optional[int]
, height
: Optional[int]
, x_stretch
: float
, y_stretch
: float
, saturation
: float
, contrast
: Optional[float]
)gradient
: str
- string containing the characters the converter will use when converting the image to ascii
width
: Optional[int]
- width in characters of the final converted image
None
0
height
: Optional[int]
- height in characters of the final converted image
None
0
x_stretch
: float
- how much to stretch the width by
1.0
(which doesn't change the width by anything)0.0
y_stretch
: float
- how much to stretch the height by
1.0
(which doesn't change the height by anything)0.0
saturation
: float
- how much to adjust the saturation
0.5
(which increases the saturation)-1.0
and 1.0
, 0.0
is no change to saturationcontrast
: Optional[float]
- how much to increase the contrast by
None
(which doesn't apply any contrast filter)0.0
and 1.0
blur
: Optional[int]
- how much to blur the image by
None
(which doesn't apply any blur)0
ConverterBase
(options
: ConverterOptions
)options
: ConverterOptions
- Options used when converting mediaasciify_image
(image
: numpy.ndarray
) -> str
calculate_dimensions
(initial_height
: int
, initial_width
: int
) -> Tuple[int, int]
apply_opencv_fx
(image
: numpy.ndarray
, *, resize_dims
: Optional[Tuple[int, int]]
) -> numpy.ndarray
GrayscaleConverter
- converts media to grayscale asciiGrayscaleConverterNim
- converters media to grayscale ascii, see the Extensions sectionColorConverter
- converts media to colored ascii using ColoramaColorConverterNim
- converts media to colored ascii using Colorama, see the Extensions sectionHtmlColorConverter
- converts media to ascii in colored html spansHtmlColorConverterNim
- converts media to ascii in colored html spans, see the Extensions sectionImage
(source
: Union[str, bytes, IOBase]
, converter
: BaseConverter
)source
: Union[str, bytes, IOBase]
- the source of the image that is to be loaded and converted
source
is a str
, it's assumed that it's a path to an image filesource
is bytes
or IOBase
it's assumed to be the data of an image and is decoded in-memoryconverter
: ConverterBase
- the converter used to convert the image
ConverterBase
to_ascii
() -> str
view
() -> None
Video
(source
: Union[str, int, bytes, IOBase]
, converter
: BaseConverter
, *, fps
: Optional[float]
, loop
: bool
)source
: Union[str, int bytes, IOBase]
- the source of the video that is to be loaded and converted
source
is a str
, it's assumed that it's a path to an image filesource
is bytes
or IOBase
it's assumed to be the data of an image and is written to a temporary file before being loaded and decoded by OpenCVsource
is an int
, it's assumed to be the index of a camera deviceVideoCapture
for more informationconverter
: ConverterBase
- the converter used to convert the image
ConverterBase
fps
: Optional[float]
- the fps to play the video at
None
None
then the fps used is fetched from OpenCV's VideoCapture
APIloop
: bool
- whether or not to loop the video when it's done playing
False
get_ascii_frames
() -> Generator[str, None, None]
- returns a generator which yields each ascii frame as it is convertedview
() -> None
- prints out each frame of the converted video
loop
parameter was set to True
earlier, then this will play the video and restart it when it finishes unless the source is liveto-ascii[speedups]
package via pip or your package manager of choiceFAQs
Convert videos, images, gifs, and even live video to ASCII art!
We found that to-ascii demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.