Page 1 of 1

Help on PS files

Posted: 2016-06-03T20:17:44-07:00
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.

Re: Help on PS files

Posted: 2016-06-03T20:30:45-07:00
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.

Re: Help on PS files

Posted: 2016-06-03T22:00:26-07:00
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.

Re: Help on PS files

Posted: 2016-06-03T22:14:40-07:00
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

Re: Help on PS files

Posted: 2016-06-03T22:48:09-07:00
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.

Re: Help on PS files

Posted: 2016-06-03T23:07:27-07:00
by fmw42
Proper IM syntax would have the -rotate 90 after reading the input image.