Author Topic: Ghostscript: The Thread  (Read 20682 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Ghostscript: The Thread
« on: April 04, 2008, 08:03:40 AM »
Creating high quality .png files from your .ps/plt files.

Code: [Select]
@echo off
:: process all the .plt files in this directory
::
echo.
for %%f in (*.plt) do gswin32c -dSAFER -dBATCH -dNOPAUSE [color=red]-r300 [/color] -sDEVICE=pnggray -sOutputFile="%%~nf.png" "%%f"
echo Done!

for more quality increase the -r switch.
TheSwamp.org  (serving the CAD community since 2003)

M-dub

  • Guest
Re: Ghostscript: The Thread
« Reply #1 on: April 04, 2008, 08:13:58 AM »
Interesting!  I'll have to save a copy of that in our plotting folder on the network.  :)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Ghostscript: The Thread
« Reply #2 on: April 04, 2008, 08:17:20 AM »
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10623
Re: Ghostscript: The Thread
« Reply #3 on: April 07, 2008, 08:59:55 AM »
Mark,

check out the ``-o'' option in the `uses.htm' found under the doc directory.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Ghostscript: The Thread
« Reply #4 on: April 07, 2008, 09:06:23 AM »
Mark,

check out the ``-o'' option in the `uses.htm' found under the doc directory.

Good tip!

Quote
-o option:
As a convenient shorthand you can use the -o option followed by the output file specification as discussed above. The -o option also sets the -dBATCH and -dNOPAUSE options. This is intended to be a quick way to invoke ghostscript to convert one or more input files. For instance, to convert somefile.ps to JPEG image files, one per page, use:

gs -sDEVICE=jpeg -o out-%d.jpg somefile.ps
is equivalent to:
gs -sDEVICE=jpeg -sOutputFile=out-%d.jpg -dBATCH -dNOPAUSE somefile.ps

TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10623
Re: Ghostscript: The Thread
« Reply #5 on: April 07, 2008, 09:20:58 AM »
It saves my fingers.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Antisthenes

  • Guest
Re: Ghostscript: The Thread
« Reply #6 on: April 07, 2008, 02:26:21 PM »
PNG  the best of both worlds

16 million colors  transparency and lossless

mmm

cool Batch file

Robb

  • Guest
Re: Ghostscript: The Thread
« Reply #7 on: April 07, 2008, 05:54:52 PM »
PNG  the best of both worlds

16 million colors  transparency and lossless

mmm

cool Batch file

What are you guys using this for? Sounds interesting. Are you using to replace PDF's?

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Ghostscript: The Thread
« Reply #8 on: April 07, 2008, 06:15:54 PM »
**Drops sonar buoy**
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Robb

  • Guest
Re: Ghostscript: The Thread
« Reply #9 on: April 07, 2008, 07:25:54 PM »
**Drops sonar buoy**

???

I'm asking what is the reason to convert plt to png? If I find it beneficial in any way I may use it.

Also, I am trying to run this script above.. I assumed I just create a .bat file and place it in a folder of plt files that I want to convert. Execute the script and all the plt files within that folder will be converted to png. Tried it and nothing happened. Then realized I may need to have ghostscript installed, installed it and still nothing. Do I need to run the script from within GSViewer?

Can someone help me out?

Thanks


Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Ghostscript: The Thread
« Reply #10 on: April 07, 2008, 07:40:02 PM »
**Drops sonar buoy**

???

I'm asking what is the reason to convert plt to png? If I find it beneficial in any way I may use it.

Also, I am trying to run this script above.. I assumed I just create a .bat file and place it in a folder of plt files that I want to convert. Execute the script and all the plt files within that folder will be converted to png. Tried it and nothing happened. Then realized I may need to have ghostscript installed, installed it and still nothing. Do I need to run the script from within GSViewer?

Can someone help me out?

Thanks

No offense meant to you Robb.  Just me being all Smart Alec. (Another words, I was being a Greg)

My comment was to reference that I wanted to watch this topic becuase just like you, I am wanting to do the same thing.  Unfortunately; I had to shelve this project just at the start of my investigations to figure out how it was done.

What I have learned so far is that it produces PDF very efficiently and of sound quality. 
You might want to take a look at this thread over .... (let me go find it) .... http://www.theswamp.org/index.php?topic=21802.0  look for Mark's and Seven's and few others comments to Ghostscript.

Sorry for the confusion.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Robb

  • Guest
Re: Ghostscript: The Thread
« Reply #11 on: April 07, 2008, 10:12:29 PM »
**Drops sonar buoy**

???

I'm asking what is the reason to convert plt to png? If I find it beneficial in any way I may use it.

Also, I am trying to run this script above.. I assumed I just create a .bat file and place it in a folder of plt files that I want to convert. Execute the script and all the plt files within that folder will be converted to png. Tried it and nothing happened. Then realized I may need to have ghostscript installed, installed it and still nothing. Do I need to run the script from within GSViewer?

Can someone help me out?

Thanks

No offense meant to you Robb.  Just me being all Smart Alec. (Another words, I was being a Greg)

My comment was to reference that I wanted to watch this topic becuase just like you, I am wanting to do the same thing.  Unfortunately; I had to shelve this project just at the start of my investigations to figure out how it was done.

What I have learned so far is that it produces PDF very efficiently and of sound quality. 
You might want to take a look at this thread over .... (let me go find it) .... http://www.theswamp.org/index.php?topic=21802.0  look for Mark's and Seven's and few others comments to Ghostscript.

Sorry for the confusion.


It's cool. I've never heard that term before so didn't know if it was a sarcastic remark or what... but there was no answer to my question that is why I gave the  :? , actually I wrote three questions marks and it substituted with that emoticon.

Thanks for the info and link! :)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Ghostscript: The Thread
« Reply #12 on: April 07, 2008, 10:28:41 PM »
I'm asking what is the reason to convert plt to png? If I find it beneficial in any way I may use it.
Well once in a while I need an image file of the plotted page, think exhibits with purdy graphics. Also it makes more sense at times to send out images rather than pdf's.

Quote
Also, I am trying to run this script above.. I assumed I just create a .bat file and place it in a folder of plt files that I want to convert. Execute the script and all the plt files within that folder will be converted to png.
Correct.

Quote
Tried it and nothing happened. Then realized I may need to have ghostscript installed, installed it and still nothing. Do I need to run the script from within GSViewer?

No. Most likely you don't have your windows path setup so that the batch file will find the gswin32c executable. Just add the complete path to the batch file and all should work. For instance, if you installed ghostscript in C:\Program Files\gs\ then you would change the batch file to read;
Code: [Select]
for %%f in (*.plt) do "C:\Program Files\gs\bin\gswin32c" -dSAFER -dBATCH -dNOPAUSE -r300  -sDEVICE=pnggray -sOutputFile="%%~nf.png" "%%f"
TheSwamp.org  (serving the CAD community since 2003)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Ghostscript: The Thread
« Reply #13 on: April 17, 2008, 12:59:47 PM »
Thanks Mark for the contents of the bat file.  This will same a lot of time when I have to print to pdf, but I do have one question.  I have searched the net, and found out how to make it show the pdf landscape, but it won't show any of the information.  I added

Code: [Select]
-c "<< /Orientation 3 >> setpagedevice"

After the output file name.  Can someone help with rotating the prints to show landscape instead of portrait?  All the information will show when portrait, but will not when landscape.

Here is my whole line (pretty much Marks) for the conversion to a pdf.
Code: [Select]
for %%f in (*.plt) do "c:\gs\gs8.54\bin\gswin32c" -dSAFER -dBATCH -dNOPAUSE -r300 -sDEVICE=pdfwrite -sOutputFile="%%~nf.pdf" -c "<< /Orientation 3 >> setpagedevice" "%%f"

Thanks.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Ghostscript: The Thread
« Reply #14 on: April 17, 2008, 01:22:24 PM »
Try this one.

Code: [Select]
for %%f in (*.plt) do "c:\gs\gs8.61\bin\gswin32c" -dSAFER -dBATCH -dNOPAUSE -sOutputFile="%%~nf.pdf" -sDEVICE=pdfwrite -c "<</Orientation 3>> setpagedevice" -f "%%f"
P.S. I'm using a newer version so you'll need to change the path to gswin32c
TheSwamp.org  (serving the CAD community since 2003)