how to use colorimage in separated component mode ? 
Author Message
 how to use colorimage in separated component mode ?
Hi,

I am trying to use colorimage in separated component mode.
I wrote a RunLength encoder, and I think that compression will be better if
each channel is compressed separately instead of compressing the pixels
values.
Imagine an image filled with the 00 0f ff color. It will not compress (and
will actually expand by a factor of 2) if interleaved, but will compress
very well using
per-channel compression.

I have made a very simple example that works, here it is (for my samples I
use here ASCIIHex encoding).
%!
gsave
100 100 translate 100 100 scale
4 4 8 [4 0 0 -4 0 4]
currentfile /ASCIIHexDecode filter
false 3 colorimage
FF 00 00 00 FF 00 FF FF 00 00 00 FF
00 00 00 FF 00 00 00 00 FF 00 FF 00
FF 00 00 00 FF 00 FF FF 00 00 00 FF
00 00 00 FF 00 00 00 00 FF 00 FF 00>
grestore
gsave
200 200 translate 100 100 scale
4 4 8 [4 0 0 -4 0 4]
currentfile /ASCIIHexDecode filter
currentfile /ASCIIHexDecode filter
currentfile /ASCIIHexDecode filter
true 3 colorimage
FF00FF00
00FF0000
FF00FF00
00FF0000>
00FFFF00
000000FF
00FFFF00
000000FF>
000000FF
0000FF00
000000FF
0000FF00>
grestore
showpage

However, I have tried with larger images and have now problems with them.
I can send two files, one generated using interleaved mode and the other
one generated with component mode.

I can send or mail the two files, they are each 11kb in size.

The first one prints OK and can be viewed by xpsview on sgi, gs5.5 on sgi
and gs7.0 on W2000.
The second can only be viewed by xpsview, gs5. 5 and gs7.0 are reporting
various errors.
When generating a file with a more larger image, xpsview too generates
errors.

Thank you,

Fred.



Mon, 08 Mar 2004 21:22:52 GMT  
 how to use colorimage in separated component mode ?

Quote:

>Hi,

>I am trying to use colorimage in separated component mode.
>I wrote a RunLength encoder, and I think that compression will be better if
>each channel is compressed separately instead of compressing the pixels
>values....

I agree, but you are probably not going to be able to use them.

Your sample program is not viable, because it presumes that creating a
filter will preload it. In fact, the underlying file (currentfile)
will be read at unpredictable times. Perhaps a little when the filter
is created, and then every so often during image processing.
postscript does not keep a separate track of the file position of
currentfile, so the data would have to be provided in-line as
required.

This is impossible to predict, so you can't work that way. You can
only have one filter at a time reading its underlying data from
currentfile.
----------------------------------------

Visit http://www.*-*-*.com/ ,
PSAlter, psalters, tea, and small {*filter*} animals. And stuff.  



Tue, 09 Mar 2004 00:59:07 GMT  
 how to use colorimage in separated component mode ?


Quote:
> I agree, but you are probably not going to be able to use them.

> Your sample program is not viable, because it presumes that creating a
> filter will preload it. In fact, the underlying file (currentfile)
> will be read at unpredictable times. Perhaps a little when the filter
> is created, and then every so often during image processing.
> PostScript does not keep a separate track of the file position of
> currentfile, so the data would have to be provided in-line as
> required.

> This is impossible to predict, so you can't work that way. You can
> only have one filter at a time reading its underlying data from
> currentfile.
> ----------------------------------------

So the correct way is to use a procedure ?
Or maybe use the dictionary version of colorimage ?
I don't know how to use the /MultipleDataSources entry in the dictionary,
something like

100 100 translate 100 100 scale
/DeviceRGB setcolorspace
<<
  /ImageType 1
  /Width 4
  /Height 4
  /BitsPerComponent 8
  /Decode[0 1 0 1 0 1]
  /ImageMatrix [4 0 0 -4 0 4]
  /MultipleDataSources true
  /DataSource [ currentfile /ASCIIHexDecode filter
                currentfile /ASCIIHexDecode filter
                currentfile /ASCIIHexDecode filter
              ]

Quote:
>> image

FF00FF00
00FF0000
FF00FF00
00FF0000>
00FFFF00
000000FF
00FFFF00
000000FF>
000000FF
0000FF00
000000FF
0000FF00>

won't work.
How can I create "an array of n such data sources" using filtered files ?

Thank you,

Frederic



Tue, 09 Mar 2004 16:37:47 GMT  
 how to use colorimage in separated component mode ?

Quote:

>So the correct way is to use a procedure ?
>Or maybe use the dictionary version of colorimage ?
>I don't know how to use the /MultipleDataSources entry in the dictionary,
>something like

No, this is no better, you have just rewritten the same problem. You
are still trying to use multiple filters on the same input stream.
This just will not work.  

If your image relies on more than one currentfile ... filter it cannot
work.

If you can put data into strings that is a possibility.
----------------------------------------

Visit http://www.*-*-*.com/ ,
PSAlter, psalters, tea, and small {*filter*} animals. And stuff.  



Tue, 09 Mar 2004 17:37:58 GMT  
 how to use colorimage in separated component mode ?

[multiple filters just don't work]

Quote:
>So the correct way is to use a procedure ?

Yes.  Set up the filter once.  Then read it from
3 separate procedures.  Since your data is
interleaved, you need the procedure to read
just the amount that matches your interleaving
factor (typically one scan-line).

Quote:
>Or maybe use the dictionary version of colorimage ?

Makes no difference.

Quote:
>I don't know how to use the /MultipleDataSources entry in the dictionary,
>something like

Sketch of how it should work incorporated in-line (not checked).

Quote:
>100 100 translate 100 100 scale

/hexfiltered currentfile /ASCIIHexDecode filter
/filterstring 4 string def
/readfiltered { hexfiltered filterrstring read pop } bin def
Quote:
>/DeviceRGB setcolorspace
><<
>  /ImageType 1
>  /Width 4
>  /Height 4
>  /BitsPerComponent 8
>  /Decode[0 1 0 1 0 1]
>  /ImageMatrix [4 0 0 -4 0 4]
>  /MultipleDataSources true
>  /DataSource [

                                //readfiltered dup dup

Quote:
>              ]
>>> image
>FF00FF00
>00FF0000
>FF00FF00
>00FF0000>
>00FFFF00
>000000FF
>00FFFF00
>000000FF>
>000000FF
>0000FF00
>000000FF
>0000FF00>

Marcel


Tue, 09 Mar 2004 19:32:34 GMT  
 how to use colorimage in separated component mode ?


Quote:



> > I agree, but you are probably not going to be able to use them.

> > Your sample program is not viable, because it presumes that creating a
> > filter will preload it. In fact, the underlying file (currentfile)
> > will be read at unpredictable times. Perhaps a little when the filter
> > is created, and then every so often during image processing.
> > PostScript does not keep a separate track of the file position of
> > currentfile, so the data would have to be provided in-line as
> > required.

> > This is impossible to predict, so you can't work that way. You can
> > only have one filter at a time reading its underlying data from
> > currentfile.
> > ----------------------------------------

Having chek the PS Ref Maunal , it seems that this is not possible to use a
simngle file
with multiple filters.
I would have liked to have a simple way to use my separated components
easily as compression can be
very important.
Maybe I can try to use three strings, each one scan line of data long,
use a procedure with eventually filters to read from these string, combine
them and
feed false 3 colorimage with that.

Frederic.



Tue, 09 Mar 2004 20:20:09 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Separating colorimage

2. Component executes code in separate thread

3. using colorimage, want rgb data in ps file

4. using Array from separate script in html drop down list box

5. Going from PostScript mode to LaserJet mode on a KX-P4455

6. Problem using Ghostscript with duplex-mode

7. Printing problem using EPS file from Ami-Pro in lanscape mode

8. Using Components for Business Logic

9. Using client's component

10. VBScript: Using ActiveX component property ENUMs?

11. Question on using a com component in VB Script

12. Please help - Using DLL in ASP to create/use out of process components

 

 
Powered by phpBB® Forum Software