Bug 689506 - review level 1 output from pscript.dll (5)
Summary: review level 1 output from pscript.dll (5)
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC Windows XP
: P4 enhancement
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-10 05:02 UTC by Ken Sharp
Modified: 2012-07-03 16:09 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
This is level 1 output containing an image with a fake /Indexed space (984.06 KB, application/postscript)
2007-10-10 05:04 UTC, Ken Sharp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Sharp 2007-10-10 05:02:10 UTC
There is code in pdfwrite which disables subsampling and lossy compression when
a non-identity transfer function is detected. This change was made for bug
#420257 some considerable time ago.

This does result in some situations where less than optimal output is generated.
It would be nice, if possible, to detect the situation better, or possibly
remove the detectio altogether if no longer required.
Comment 1 Ken Sharp 2007-10-10 05:04:47 UTC
Created attachment 3456 [details]
This is level 1 output containing an image with a fake /Indexed space
Comment 2 leonardo 2007-10-10 06:13:11 UTC
Regarding Comment #1 :

The file starts with "%!PS-Adobe-3.0", so I'm not sure whether it's really 
level 1. Later there is DSC comment "%%LanguageLevel: 1".

I tried this :
  gswin32c.exe -r144 -dBATCH -d/DEBUG -c 1 .setlanguagelevel -f cowgifword.ps

and got /dictfull in definefont. It's another bug though.
Comment 3 Ken Sharp 2007-10-10 06:40:09 UTC
As I understand it, the %!PS-Adobe-3.0 refers to the version of Document
Structure Convention which the file conforms to, it doesn't by itself indicate
any particular PostScript language level. SO I think this means its a DSC 3.0 file.

I'd go with the %%LanguageLevel: 1 comment which ties up with the DIB ProcSet
comment.

I can't really say why you would get a dictfull in definefont, but language
level 1 implementations varied considerably, many implemented extensions which
weren't part of the original language. I don't know what limitations Ghostscript
imposes if you force language level to 1....

Comment 4 Ray Johnston 2007-10-16 09:40:08 UTC
Dictionaries that automatically expand are a Level 2 feature. When Ghostscript
is set to emulate Level 1, it disables the automatic growth of dicts, so that
PS that relies on this will get an error (just as they would on a Level 1 printer).

Generally, you don't want to change the languagelevel, and GS should be able to
handle the PSCRIPT.DLL output without this. I'd recommend against trusting the
DSC comments to execute a .setlanguagelevel since DSC comments are notoriously
unreliable.

I'm not sure that special handling in pdfwrite for  this type of Level 1
(ab)use is worth optimizing. Subsampling seems like it should be safe.
 
Comment 5 Ken Sharp 2007-10-16 10:36:59 UTC
The issue isn't really with level 1 internally, more to do with processing the
result of selecting a level 1 device with this driver.

Although it seems that subsampling should be safe, when I tried it with this job
I got garbage output (Really garbage, not just problems with Acrobat not
applying the transfer function).

Its probably not worth looking at, but maybe one day....

Comment 6 Ray Johnston 2008-04-17 10:59:08 UTC
Assigning to the owner of this area. Priority is still low, and this enhancement
may never be done.
Comment 7 Shailesh Mistry 2011-07-23 14:37:20 UTC
Enhancement still missing in Ghostscript 9.03
Comment 8 Ken Sharp 2012-07-03 16:09:58 UTC
This is now done in commit 0bc05670e841517b8a2041999c19c19507874a4a

If we have either an Indexed colour space, or a non-identity transfer function we temporarily set the downsampling to Subsample (but don't otherwise enable it) and the compression to 'lossless'.

This means that these kinds of input can now use downsampling and benefit from compression, resulting in smaller output PDF files.