Problem with "convert" from a multipage ps file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Stefano90
Posts: 4
Joined: 2015-12-08T08:31:26-07:00
Authentication code: 1151

Problem with "convert" from a multipage ps file

Post by Stefano90 »

Hello,

I have a problem with conversion from ps to png file:

I have a multipage ps file with some plots, the first page is converted without any problem, this is the result:
http://188.138.57.168/out-0.png

but the other pages are shifted about 40 pixel on top, and I can't understand the reason:
http://188.138.57.168/out-1.png
http://188.138.57.168/out-2.png
...

This is the code i have used:

Code: Select all

convert -geometry 1300x1300 -density 300 -depth 4 gwrf_merc.ps out.png
I tried also -gravity center, crop function, without any change.

Can anyone help me to solve this issue?

Thank you very much,
Stefano G.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problem with "convert" from a multipage ps file

Post by dlemstra »

Can you also share your input file and tell us your platform and version of ImageMagick?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Stefano90
Posts: 4
Joined: 2015-12-08T08:31:26-07:00
Authentication code: 1151

Re: Problem with "convert" from a multipage ps file

Post by Stefano90 »

Thank you for yuor answer

I uploaded my ps file (an example of 2 pages):
http://188.138.57.168/gwrf_merc.ps

I use CentOS Linux 7.1.1503
The version of ImageMagick is 6.9.2-5 Q16 x86_64
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with "convert" from a multipage ps file

Post by fmw42 »

What delegates do you have installed --- what do you get from

Code: Select all

convert -version
Does the list include gs or gslib (Ghostscript)?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with "convert" from a multipage ps file

Post by fmw42 »

convert -geometry 1300x1300 -density 300 -depth 4 gwrf_merc.ps out.png
-geometry should not be used to resize an image. use -resize. try

Code: Select all

convert -density 300 gwrf_merc.ps -resize 1300x1300 -depth 4 out.png
That seems to work for me on IM 6.9.2.8 Q16 Mac OSX Snow Leopard.

Code: Select all

convert -version
Version: ImageMagick 6.9.2-8 Q16 x86_64 2015-12-07 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules 
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib
Note gslib in the list of Delegates.
Stefano90
Posts: 4
Joined: 2015-12-08T08:31:26-07:00
Authentication code: 1151

Re: Problem with "convert" from a multipage ps file

Post by Stefano90 »

This is the response from convert -version

Code: Select all

Version: ImageMagick 6.9.2-5 Q16 x86_64 2015-12-08 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP 
Delegates (built-in): bzlib freetype gslib jng jpeg png ps tiff x zlib
I tried to copy your new code, but the result is the same:
http://188.138.57.168/out-0.png works fine
http://188.138.57.168/out-1.png cut the upper border
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with "convert" from a multipage ps file

Post by fmw42 »

I had not noticed, but mine gets trimmed at the top also. I am sorry, I do not know what else to do. You might try upgrading your Ghostscript.

Mine is a bit old

Code: Select all

gs --version
9.10
Stefano90
Posts: 4
Joined: 2015-12-08T08:31:26-07:00
Authentication code: 1151

Re: Problem with "convert" from a multipage ps file

Post by Stefano90 »

I have 9.15 gs version.

There is a way to shift down the image? Because if you see the bottom corner, it's trasparent. Seems the "convert" function shift up the real image from "container"

Thank you very much,
Stefano.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem with "convert" from a multipage ps file

Post by fmw42 »

As I recall, 9.15 had some problems. Try upgrading.

You can use the -roll function to shift the image. See http://www.imagemagick.org/script/comma ... s.php#roll

You can also pad at the top using either -extent or -splice. See http://www.imagemagick.org/Usage/crop/#extent and http://www.imagemagick.org/Usage/crop/#splice
Post Reply