Bug 692313 - Image output does not work from "-c {some postscript code}" input
Summary: Image output does not work from "-c {some postscript code}" input
Status: RESOLVED INVALID
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Other Driver (show other bugs)
Version: 9.02
Hardware: PC Linux
: P4 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-29 08:37 UTC by pipitas
Modified: 2011-06-29 11:10 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pipitas 2011-06-29 08:37:15 UTC
This command does work and produces an output PDF:

  /usr/bin/gs \
    -o arc-pdfwrite.pdf \
    -sDEVICE=pdfwrite \
    -c "newpath \
        306 400 moveto \
        10 setlinewidth \
        .9 setgray \
        306 400 280 -45 235 arc \
        closepath \
        stroke"

However, this command does NOT work, produces NO output PNG (and also no error message or warning):

  /usr/bin/gs \
    -o arc-png256.png \
    -sDEVICE=png256 \
    -c "newpath \
        306 400 moveto \
        10 setlinewidth \
        .9 setgray \
        306 400 280 -45 235 arc \
        closepath \
        stroke"
  GPL Ghostscript SVN PRE-RELEASE 9.02 (2011-02-07)
  Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
  This software comes with NO WARRANTY: see the file PUBLIC for details.

The same is true (no output) for all other image output devices that I've tested:
 * tiffg4,
 * jpeg,
 * ppm,
 * png16,
 * png16m,
 * png256,
 * png48,
 * pngalpha,
 * pnggray,
 * pngmono.

I'm not sure if what I tried to do is supposed to work at all. However, since it works with PDF input, I'm inclined to think it should.

Also, if I replace the "-c {postscript code}" input by the PDF file produced by the first command, it works as expected for all tested devices:

  /usr/bin/gs \
    -o arc-png256.png \
    -sDEVICE=png256 \
     arc-pdfwrite.pdf

Tested with GS v9.02 (released with Ubuntu Natty) and with current Git master (self-compiled from sources).
Comment 1 Ken Sharp 2011-06-29 08:49:35 UTC
If you put a 'showpage' in there it'll work fine. 

The pdfwrite device (and other devices based on the vector output device) is special, because it only writes its output when the device is closed, so there is an implicit 'showpage'.
Comment 2 pipitas 2011-06-29 11:10:48 UTC
D'oh!

I missed the closing "showpage" statement in my PostScript snippet(s).

If added, output works fine for all image devices. Only for pdfwrite it also works without the "showpage".