LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-12-2007, 06:36 AM   #1
abhattacharya
Member
 
Registered: Jul 2007
Distribution: RHEL, Fedora, Debian, Ubuntu
Posts: 94

Rep: Reputation: 15
Unhappy postscript to jpeg


Hello
i am using fedora 6. can any body suggest how can i convert a image postscript file to a jpeg file?
which type of software do i need?
or any specific command etc. ?
please help me out
 
Old 12-12-2007, 07:13 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
You can use gs (ghostscript). For example, if you have a postscript file called testpage-a4.ps, and want to make a jpg file with an image of the content of this file, you can do it with this command:
Code:
gs -sDEVICE=jpeg -sOutputFile=testpage-a4.jpg - < testpage-a4.ps
 
Old 12-12-2007, 07:46 AM   #3
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
To expands upon matthewg42's command:
Code:
gs -sDEVICE=jpeg -r300 -sPAPERSIZE=a4 -dBATCH -dNOPAUSE -sOutputFile=testpage-a4.jpg testpage-a4.ps
I add the -r to specify dpi resolution, and the papersize maintains the a4 proportions, otherwise I think it'll default to letter (8" by 11"). The dBATCH and dNOPAUSE are useful for doing batches of postscripts, so that gs doesn't wait for you to hit enter. This could be used in a script as follows:
Code:
for image in ./images/*; do
   gs -sDEVICE=jpeg -r300 -sPAPERSIZE=a4 -dBATCH -dNOPAUSE \
      "-sOutputFile=${image%.ps}.jpg" "$image"
done
edit: matthewg42, is there any advantage of specifying the - in gs and redirecting the postscript file using <, rather than just specifying it as an argument in the gs command?

Last edited by pwc101; 12-12-2007 at 07:49 AM.
 
Old 12-12-2007, 07:51 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Quote:
Originally Posted by pwc101 View Post
edit: Matthew, is there any advantage of specifying the - in gs and redirecting the postscript file using <, rather than just specifying it as an argument in the gs command?
It just prevents "showpage, press <return> to continue" messages after each page, and stops the GS> prompt from appearing after the file is processed. It is just another way to accomplish what the -dBATCH -dNOPAUSE options do.
 
Old 12-12-2007, 08:23 AM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,037

Rep: Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755Reputation: 755
You already have a PostScript file? You can use ImageMagick; e.g.,
Code:
display file.ps
left click in the image
click File
click save
click Format
select jpeg or jpg
click save
 
Old 12-12-2007, 10:20 AM   #6
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
Quote:
Originally Posted by tronayne View Post
You can use ImageMagick
Yes you can:
Code:
convert foo.ps foo.jpg
 
Old 12-12-2007, 11:50 AM   #7
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by osor View Post
Yes you can:
Code:
convert foo.ps foo.jpg
I found that the default output from this command made for dreadful quality images. I don't know how you specify a higher resolution using convert...
 
Old 12-12-2007, 11:56 AM   #8
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Quote:
Originally Posted by pwc101 View Post
I found that the default output from this command made for dreadful quality images. I don't know how you specify a higher resolution using convert...
You can pass the resolution to convert using the -resample option:
Code:
convert -resample 300 file.ps file.jpg
 
Old 07-10-2012, 02:25 AM   #9
sswam
LQ Newbie
 
Registered: Dec 2009
Posts: 10

Rep: Reputation: 1
pstoimg

I like pstoimg from LaTeX2HTML. If it's good enough for LaTeX...

Code:
apt-get install latex2html || wget http://sam.nipl.net/code/pstoimg/+pstoimg.tgz && ...
pstoimg -scale 2 -type png -antialias -aaliastext -multipage -out output.png input.ps
Or, you can use my a2b program, with Advanced Graph Search Logic (TM).
It can convert almost anything to almost anything else. a2b prefers pstoimg, in this case.

I am also using ps2epsi to crop the thing nicely, and `ps2pdf -dEPSCrop $< $@` for cropped pdf...

Drifting into irrelevance...
 
  


Reply

Tags
ghostscript, gs, jpeg, jpg, postscript


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
postscript hyperlinks Tischbein Programming 2 07-10-2011 09:50 AM
Postscript: a few questions RobertoBech Linux - General 7 11-28-2007 01:37 PM
Need some help with Postscript robogymnast Programming 2 01-19-2006 02:56 PM
Postscript Files 0roy0m0 Linux - Software 1 01-16-2006 08:31 AM
Postscript Problem E-Oreo Linux - General 0 01-03-2004 06:21 PM


All times are GMT -5. The time now is 08:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration