convert txt image to png with transparent gets empty image
Posted: 2019-05-07T01:39:18-07:00
Hi, when i convert a txt image to a png image, it gives me an empty file. How can i get the correct image ?
Below is an example:
# step1. create an test image with one red point
convert -size 2x2 xc:none -fill red -draw 'point 1,1' redPoint.png
# step2. convert the image to a txt file
convert redPoint.png redPoint.txt
# step3. convert the txt file back to png file. But it returned a blank picture and the red point disappeared.
convert redPoint.txt save.png
# step4. convert the txt file to png file with "-alpha off".The red point is displayed again, but it is no longer a transparent image.
convert redPoint.txt -alpha off save.png
Question: How can i convert the txt file to a transparent image with red point (step3)?
Platform:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
Imagemagick Version:
Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
Below is an example:
# step1. create an test image with one red point
convert -size 2x2 xc:none -fill red -draw 'point 1,1' redPoint.png
# step2. convert the image to a txt file
convert redPoint.png redPoint.txt
# step3. convert the txt file back to png file. But it returned a blank picture and the red point disappeared.
convert redPoint.txt save.png
# step4. convert the txt file to png file with "-alpha off".The red point is displayed again, but it is no longer a transparent image.
convert redPoint.txt -alpha off save.png
Question: How can i convert the txt file to a transparent image with red point (step3)?
Platform:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
Imagemagick Version:
Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib