strange lines converting from PS to JPG/PNG

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
diego1979
Posts: 2
Joined: 2018-10-10T04:47:50-07:00
Authentication code: 1152

strange lines converting from PS to JPG/PNG

Post by diego1979 »

Hi,
using convert on a PS file, generated by GMT (Global Mapping Tool), in JPG/PNG i see strange lines. I've done some test using different software to convert the PS and the problem doesn't occour (so, i think, is a convert bug).

The PS file

Bugged conversion
convert image-by-GMT.ps -trim -density 300x300 -flatten using-convert.png
convert image-by-GMT.ps -trim -density 300x300 -flatten using-convert.jpg

Correct conversion
pstoimg -type png -antialias -aaliastext -out using-pstoimg.png image-by-GMT.ps
gs -sDEVICE=jpeg -sOutputFile="using-gs.jpeg" - < image-by-GMT.ps
using gimp to png (via GUI)

P.s.: I was using the same script on an old Debian stable (7.4) and it was working perfectly.

$ cat /etc/debian_version:

Code: Select all

9.5
$ convert --version

Code: Select all

Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib

Code used to reproduce the error

Code: Select all

#!/bin/sh
SOURCE_PS=image-by-GMT.ps

gmt psbasemap -R4/20/36/48 -JM17c  -Lf6.673/36.759/42.840/100.000+lkm  -P -K > $SOURCE_PS
gmt pscoast -R4/20/36/48 -JM17c -S225/243/255 -Df -N1 -W0.25p -B2.5g2.5 -O >> $SOURCE_PS

pstoimg -type png -antialias -aaliastext  -out using-pstoimg.png $SOURCE_PS

convert $SOURCE_PS  -trim  -density 300x300 -flatten using-convert.png
convert $SOURCE_PS  -trim  -density 300x300 -flatten using-convert.jpg

gs -sDEVICE=jpeg -sOutputFile="using-gs.jpeg" - < $SOURCE_PS
Thanks in advance

Diego
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: strange lines converting from PS to JPG/PNG

Post by snibgo »

The extra lines are artefacts from rasterizing at a low density. Try a higher density, eg 600:

Code: Select all

convert -density 600 image-by-GMT.ps -trim -flatten out.png
snibgo's IM pages: im.snibgo.com
diego1979
Posts: 2
Joined: 2018-10-10T04:47:50-07:00
Authentication code: 1152

Re: strange lines converting from PS to JPG/PNG

Post by diego1979 »

Hi Snibgo,
thank you!!!
looking at your code i see my two errors:
1. -density 600
2. -density must be before filename.ps

Thank you :-)

Diego
Post Reply