Help on PS files

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
Jujubs
Posts: 3
Joined: 2016-06-03T19:58:21-07:00
Authentication code: 1151

Help on PS files

Post by Jujubs »

Hi,

I have these .ps files with me. I have few basic questions as Im totally new to imagemagick.
https://drive.google.com/open?id=0BzSCw ... lducjRQWWs

1. The .ps files I have are rotated. How can I orient them correctly.
when I tried convert -rotate 90 only a part of the file is shown

2. I tried to convert them to .png again the same error happens ( part of file missing)
convert test.ps test.png

3. When tried to make an animation with these ps files
a. I got the same orientation problem as in 1.
b. and the background is transparent which resulted in black background

convert *ps test.gif

how can i get this done correctly ?

Any help is much appreciated.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help on PS files

Post by fmw42 »

What is your IM version and platform? What do you get from

Code: Select all

convert -version
Perhaps you are missing ghostscript (gslib) from the list of Delegates?

It fails for me. As best I can determine, the files are corrupt. There is no orientation data, it says "Orientation: Undefined". So you cannot use IM -auto-orient to automatically rotate the image. Also it is converting the image as if the width and height are reversed, even though IM identify -verbose, shows the width > height. I even used -strip to remove any meta data. I think that ps:HiResBoundingBox: 678.9x529.3+52.4+11.1 might be what is the issue, though I do not know for sure.

Sorry, I do not know what to tell you. For some reason, Ghostscript is misinterpretting your dimensions. Other viewers seem to handle the size correctly. So I am not sure what to tell you. IM relies upon Ghostscript delegate to process the file, as far as I know.

Perhaps Ghostscript does not know how to handle PS level 2 files. I am using an older ghostscript at 9.16. Perhaps a newer versions might work better.
Jujubs
Posts: 3
Joined: 2016-06-03T19:58:21-07:00
Authentication code: 1151

Re: Help on PS files

Post by Jujubs »

Hi fmw42

thanks much for the reply.
my version is ImageMagick 6.7.7-10

When I use ghostscript command
gs -dEPSCrop -c "<</Orientation 3>> setpagedevice" -f plot001.ps -c quit
I can see the image in correct orientation.

Still I dont know how to save it in this orientation and change background to white posibly.

Thanks again and any help is much appreciated.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help on PS files

Post by fmw42 »

You can edit the delegates.xml file to modify the use of gs with your specific commands. 6.7.7.10 is ancient (over 150 versions old). You might consider upgrading. What is your version of gs?

Code: Select all

gs --version
Jujubs
Posts: 3
Joined: 2016-06-03T19:58:21-07:00
Authentication code: 1151

Re: Help on PS files

Post by Jujubs »

Hi all,

Thanks so much for the help. I finally got it done this way.

#!/bin/bash

# Loop through all files ending in ".ps"
for f in *.ps; do

# Determine output filename
out=${f%%ps}
out="${out}png"

# Show the command we would run
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile="$out" "$f"
convert -rotate 90 "$out" "$out"

done

convert *.png test.gif
rm *.ps
rm *.png

HTH with someone with same kinda issue.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help on PS files

Post by fmw42 »

Proper IM syntax would have the -rotate 90 after reading the input image.
Post Reply