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
convert txt image to png with transparent gets empty image
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert txt image to png with transparent gets empty image
It works fine for me, with IM 6.9.9-50. What is in your redPoint.txt? I get:
Code: Select all
# ImageMagick pixel enumeration: 2,2,65535,srgba
0,0: (0,0,0,0) #00000000 none
1,0: (0,0,0,0) #00000000 none
0,1: (0,0,0,0) #00000000 none
1,1: (65535,0,0,65535) #FF0000FF red
snibgo's IM pages: im.snibgo.com
Re: convert txt image to png with transparent gets empty image
Thanks for your reply, the contents of redPoint.txt are as follows:snibgo wrote: ↑2019-05-07T04:54:17-07:00 It works fine for me, with IM 6.9.9-50. What is in your redPoint.txt? I get:Code: Select all
# ImageMagick pixel enumeration: 2,2,65535,srgba 0,0: (0,0,0,0) #00000000 none 1,0: (0,0,0,0) #00000000 none 0,1: (0,0,0,0) #00000000 none 1,1: (65535,0,0,65535) #FF0000FF red
Code: Select all
# ImageMagick pixel enumeration: 2,2,255,srgba
0,0: (0,0,0,0) #00000000 none
1,0: (0,0,0,0) #00000000 none
0,1: (0,0,0,0) #00000000 none
1,1: (255,0,0,1) #FF0000 red
Code: Select all
# ImageMagick pixel enumeration: 2,2,65535,srgba
0,0: (0%,0%,0%,0) #0000000000000000 none
1,0: (0%,0%,0%,0) #0000000000000000 none
0,1: (0%,0%,0%,0) #0000000000000000 none
1,1: (100%,0%,0%,1) #FFFF00000000 red
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert txt image to png with transparent gets empty image
I suppose so. I suggest you use a more recent version.ddosimg wrote:Is this a bug in IM 6.8.9-9 Q16?
snibgo's IM pages: im.snibgo.com
Re: convert txt image to png with transparent gets empty image
Thanks for your help.
But ...
If I use IM 6.9.10-27 Q16, I will run into another problem.
https://www.imagemagick.org/discourse-s ... =1&t=35990
How can I solve these two problems at the same time, thank you.