Home > Archive > PostScript > December 2005 > Problem with Image Masking - ioerror on large images
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problem with Image Masking - ioerror on large images
|
|
| Paul Walker 2005-12-09, 7:18 pm |
| Hello -
I'm working with PS Level 3, and trying to use a masked image.
I've been testing the code with my printer (a level 3 PS printer,
running Adobe PS 3015.102). My testcases have worked well with a
320x240 image. I now have a testcase with a 2240x1680 image, and the
printer will not print it. It gives an ioerror while processing the
image operator, and the error page suggests that it has not read beyond
the mask image.
I've included the skeleton of a working and a failing testcase
below. I'm confident that the image data in these testcases is OK,
because they will distill with Acrobat, and if I process them
separately (no masking), then they will print, and they will also
render in Ghostscript. Ghostscript can't handle the masking due to
other bugs in GS.
Questions:
1) Are there any obvious problems with the code?
2) Are there any implementation limits that I am crossing?
3) Do these program work on other RIPs (I can supply the full
programs, please Email [watch out for 'remove'])?
4) Suggestions?
Thanks for your help,
Paul
Here is a working PS file (with the specific mask and image data
trimmed to shorten post):
------------------------------------------------------------
%!
% This will print on the printer, and it will distill
% Create a dictionary with space for 80 elements
80 dict begin
/PageSize 2 array def
/setpagesize {
PageSize aload pop
3 index eq exch 4 index eq and
{ pop pop pop}
{
PageSize dup 1 5 -1 roll put 0 4 -1 roll put dup where
{ exch get exec}
{
pop /setpagedevice where
{ pop 1 dict dup /PageSize PageSize put setpagedevice}
{
/setpage where
{ pop PageSize aload pop pageparams 3 {exch pop} repeat
setpage} if
}
ifelse
}
ifelse
}
ifelse
} bind def
%%EndProlog
%%Page: 1 1
%%BeginPageSetup
612 792 /letter setpagesize
save
%%EndPageSetup
gsave mark
/DeviceGray setcolorspace
288 216 translate
/MaskDict <<
/ImageType 1
/Width 1200
/Height 900
/BitsPerComponent 1
/ImageMatrix [4.166667 0 0 -4.166667 0 900 ]
/Decode [0 1]
/DataSource currentfile /ASCIIHexDecode filter
/DeviceRGB setcolorspace
/ImageDict <<
/ImageType 1
/Width 320
/Height 240
/BitsPerComponent 8
/ImageMatrix [1.11111 0 0 -1.11111 0 240 ] % matrix
/Decode [0 1 0 1 0 1]
/DataSource currentfile /ASCII85Decode filter << >> /DCTDecode filter
% datasrc[color=darkred]
<<
/ImageType 3
/DataDict ImageDict
/MaskDict MaskDict
/InterleaveType 3[color=darkred]
image
ffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffff
ff
% [ mask data trimmed ]
ffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffff
ff
ffffffffffffffffffffffffffffffffffffffff
ffffffffffffffff[color=darkred]
>
s4IA0 !"_al 8O`[\ !WW3$ !!*'" s5<qf ;-$%U !"8r0 !.t7O s4[O, !"&r: &.&RJ
$P*t#
% [ image data trimmed ]
rr?=O -jGS/ !9=#, 6[t`R Uh&E_ 'akG! AsnS( s3gr# ~>
cleartomark grestore showpage
------------------------------------------------------------
Here is a failing PS file, (again shortened):
%!
% This will not print on the printer, but it will distill.
% Create a dictionary with space for 80 elements
80 dict begin
/PageSize 2 array def
/setpagesize {
PageSize aload pop
3 index eq exch 4 index eq and
{ pop pop pop}
{
PageSize dup 1 5 -1 roll put 0 4 -1 roll put dup where
{ exch get exec}
{
pop /setpagedevice where
{ pop 1 dict dup /PageSize PageSize put setpagedevice}
{
/setpage where
{ pop PageSize aload pop pageparams 3 {exch pop} repeat
setpage} if
}
ifelse
}
ifelse
}
ifelse
} bind def
%%EndProlog
%%Page: 1 1
%%BeginPageSetup
612 792 /letter setpagesize
save
%%EndPageSetup
gsave mark
/DeviceGray setcolorspace
288 216 translate
/MaskDict <<
/ImageType 1
/Width 1200
/Height 900
/BitsPerComponent 1
/ImageMatrix [4.166667 0 0 -4.166667 0 900 ]
/Decode [0 1]
/DataSource currentfile /ASCIIHexDecode filter
/DeviceRGB setcolorspace
/ImageDict <<
/ImageType 1
/Width 2240
/Height 1680
/BitsPerComponent 8
/ImageMatrix [7.77777 0 0 -7.77777 0 1680 ] % matrix
/Decode [0 1 0 1 0 1]
/DataSource currentfile /ASCII85Decode filter << >> /DCTDecode filter
% datasrc[color=darkred]
<<
/ImageType 3
/DataDict ImageDict
/MaskDict MaskDict
/InterleaveType 3[color=darkred]
image
ffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffff
ff
% [ mask data trimmed ]
ffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffff
ff
ffffffffffffffffffffffffffffffffffffffff
ffffffffffffffff[color=darkred]
>
s4IA1 )5K]G Bk@>F 9hbU; !!!!) !"&`; !!3-# !!WE' !/:Lc !!3-# !"&]+ !/ppk
!!<3$
% [ image data trimmed ]
-8.)[ 5jYC5 ]4(fe iDF?p XNZXX Z*8*1 5SX1B GB8LX Ni<!+ s4I ~>
cleartomark end restore showpage
------------------------------------------------------------
| |
| Roger Willcocks 2005-12-11, 10:12 pm |
| "Paul Walker" <gnewsremove1@uugw.hifn.com> wrote in message
news:1134160136.425180.305510@z14g2000cwz.googlegroups.com...
> Hello -
>
> I'm working with PS Level 3, and trying to use a masked image.
> I've been testing the code with my printer (a level 3 PS printer,
> running Adobe PS 3015.102). My testcases have worked well with a
> 320x240 image. I now have a testcase with a 2240x1680 image, and the
> printer will not print it. It gives an ioerror while processing the
> image operator, and the error page suggests that it has not read beyond
> the mask image.
>
....
> <<
> /ImageType 3
> /DataDict ImageDict
> /MaskDict MaskDict
> /InterleaveType 3
> image
An InterleaveType 3 image has two separate data sources, which means that
generally speaking the interpreter needs to read (and squirrel away) the
whole of one image before it can start reading (and processing) the other
one. If the interpreter can't buffer enough data it will generate an error.
There are a couple of ways to fix the problem - use a different
InterleaveType, or use a ReusableStreamDecode filter for the first (or
indeed both) images.
--
Roger
| |
| Paul Walker 2005-12-12, 4:13 am |
| Roger Willcocks wrote:
> "Paul Walker" <gnewsremove1@uugw.hifn.com> wrote in message
> news:1134160136.425180.305510@z14g2000cwz.googlegroups.com...
> ...
>
> An InterleaveType 3 image has two separate data sources, which means that
> generally speaking the interpreter needs to read (and squirrel away) the
> whole of one image before it can start reading (and processing) the other
> one. If the interpreter can't buffer enough data it will generate an error.
This makes sense. The curious thing is what I get from the error
handler. The error handler reports a problem in the DCTDecode filter,
but is also shows the next 320 byte of data in the input buffer. These
bytes are in the mask. How can it have a problem with the DCTDecode
filter if it hasn't finished reading the mask yet? It appears as
though it is using mask data for the DCTDecode filter, but I don't
understand how (bad error checking?)
> There are a couple of ways to fix the problem - use a different
> InterleaveType, or use a ReusableStreamDecode filter for the first (or
> indeed both) images.
I'll have to look into the reuseable filter (yet another new thing
:-) Thanks very much for the hint.
> --
> Roger
Paul
| |
| Paul Walker 2005-12-13, 4:13 am |
| I tried the ReusableStreamDecode, and it worked - sort of. After
reading up on these, I'd like to use one for both the mask and image.
The problem is that when I try to use it for the data source, I get a
limitcheck. The offending command is "filter", and the top of the
operand stack is /ReusableStreamDecode. Looking at the next 320 bytes
in the stream, it looks like it has read quite a distance into the data
for the image. I looked for documentation on limits relating to the
size of a file (that is what I'm creating, right?), or other item that
seems likely, but I don't see one.
1) Where can I find documentation on the nature of the limit that I'm
exceeding?
2) My decode filter string is ASCII85 -> DCT -> ReusableStream. Should
it work if I split the stream, leaving the DCT decode in the
dictionary, like this?
currentfile ASCII85Decode filter ReuswableStreamDecode filter
[data] ~> /datastream exch def
/DataDict <<
/DataSource datastream DCTDecode filter
3) Any other bright ideas?
Thanks,
Paul
Roger Willcocks wrote:[color=darkred]
> "Paul Walker" <gnewsremove1@uugw.hifn.com> wrote in message
> news:1134160136.425180.305510@z14g2000cwz.googlegroups.com...
> ...
>
> An InterleaveType 3 image has two separate data sources, which means that
> generally speaking the interpreter needs to read (and squirrel away) the
> whole of one image before it can start reading (and processing) the other
> one. If the interpreter can't buffer enough data it will generate an error.
>
> There are a couple of ways to fix the problem - use a different
> InterleaveType, or use a ReusableStreamDecode filter for the first (or
> indeed both) images.
>
> --
> Roger
| |
| Roger Willcocks 2005-12-13, 4:13 am |
| "Paul Walker" <gnewsremove1@uugw.hifn.com> wrote in message
news:1134454966.528833.189240@o13g2000cwo.googlegroups.com...
>I tried the ReusableStreamDecode, and it worked - sort of. After
> reading up on these, I'd like to use one for both the mask and image.
> The problem is that when I try to use it for the data source, I get a
> limitcheck. The offending command is "filter", and the top of the
> operand stack is /ReusableStreamDecode. Looking at the next 320 bytes
> in the stream, it looks like it has read quite a distance into the data
> for the image. I looked for documentation on limits relating to the
> size of a file (that is what I'm creating, right?), or other item that
> seems likely, but I don't see one.
>
> 1) Where can I find documentation on the nature of the limit that I'm
> exceeding?
> 2) My decode filter string is ASCII85 -> DCT -> ReusableStream. Should
> it work if I split the stream, leaving the DCT decode in the
> dictionary, like this?
> currentfile ASCII85Decode filter ReuswableStreamDecode filter
> [data] ~> /datastream exch def
> /DataDict <<
> /DataSource datastream DCTDecode filter
> 3) Any other bright ideas?
A1) The printer has to save the image data away somewhere, you'll hit a
limit when all the memory / disk has filled up.
A2) That should work and it should have the benefit that the printer only
has to buffer the compressed data, not the uncompressed data.
A3) Try setting AsyncRead true (see p154 PLRM III).
Failing that you'll need to use a different interleave type, I think.
--
Roger
| |
| Paul Walker 2005-12-15, 3:58 am |
| Roger Willcocks wrote:
> "Paul Walker" <gnewsremove1@uugw.hifn.com> wrote in message
> news:1134454966.528833.189240@o13g2000cwo.googlegroups.com...
[...][color=darkred]
>
> A1) The printer has to save the image data away somewhere, you'll hit a
> limit when all the memory / disk has filled up.
I haven't put in any instrumentation, but the printer has a 18GB
drive and 384MB of RAM. The decoded image would only be about 11MB at
24 bits/pixel. I have a hard time believing that the HD is full.
My impression is that PS2 and PS3 are more free with their limits,
so I'm surprised at running into this problem, unless it is a hard
limit. Any hints here? I'm certainly open to input from other
experienced PS folks out there. I can't believe I'm the first person
to blaze this trail. Help, please!!! Thanks in advance.
> A2) That should work and it should have the benefit that the printer only
> has to buffer the compressed data, not the uncompressed data.
I tried this, and it helps. Now the limitcheck occurs about 3000
lines further into the file :-(
> A3) Try setting AsyncRead true (see p154 PLRM III).
No Change - it still gets a limitcheck at the same place (as near
as I can tell from the error report).
> Failing that you'll need to use a different interleave type, I think.
In theory, this might work. However, I'm avoiding this idea as
long as possible, because the other interleave types require the mask
data to be interleaved on either a per sample basis, or a per row
basis. The source for the image is a JPG file, and the mask has been
computed independently. The idea of combining the two streams into one
is a bit scary. It will also constrain the mask to be at the same
resolution as the image, which is undesireable to me.
Paul
> --
> Roger
| |
| François Robert 2005-12-15, 3:58 am |
| "Paul Walker" <gnewsremove1@uugw.hifn.com> wrote in
news:1134625249.981591.18000@z14g2000cwz.googlegroups.com:
> It will also constrain the mask to be at
> the same resolution as the image, which is
> undesireable to me.
I think that if you use the interleaved type 2, your options are a bit more
open than that :
- One vertical resolution can be an integer multiple of the other. (say one
row of mask data can cover N rows of image or N rows of mask can cover one
row of data).
- The horizontal resolutions are not constrained. Horizontal pixel counts
of the mask and of the data are independent.
________________________________________
_______________
François Robert
(to mail me, reverse character order in reply address)
|
|
|
|
|