Subject: RE: [IPP] Question on PWG draft specification mismatch & parsing

From: "Petrie, Glen" <[email-masked]>
Date: Wed, 4 May 2011 12:57:43 -0700

I was looking some of the PWGR images you provided.  I expected the
sgray-8 to have 8 bits/color and 8 bits/pixel but the file shows 24
bits/pixel.  Which is correct?

Glen

________________________________

From: [email-masked] [mailto:[email-masked]] On Behalf Of Roy
Samuel
Sent: Thursday, April 28, 2011 9:47 PM
To: [email-masked]; Michael Sweet
Subject: [IPP] Question on PWG draft specification mismatch & parsing

Hi Michael,

I had downloaded the sample PWGRaster files from:
http://ftp.easysw.com/pub/cups/examples/PWGRasterSamples.zip, with your
latest working draft of the PWG raster found at:
ftp://ftp.pwg.org/pub/pwg/ipp/wd/wd-ippraster10-20110327-rev.pdf. I
compared the raster files in the folders:

PWGRasterSamples\srgb-16  &

PWGRasterSamples\srgb-8, with the specs given in the draft document.

I found that neither of the directories contained files that adhered to
the draft document w.r.t parsing the header. Specifically for the value
of 'NumColors'. 

--1--

According to the draft document, bytes 420-423 need to contain
'NumColors' value, however, I found them to be zero. Are the sample
files outdated??

--2--

Based on the decode algorithm given in the draft document, I had tried
to obtain plain RGB raster data from a pwg-raster file. I had converted
the PDF document obtained here:
http://orenyomtov.com/downloads/testpage.pdf to obtain pwg-raster file
using Google cloud print. I am able to get the pwg-raster file from GCP
successfully. However, on converting the pwg-raster file to RGB data,  I
have been successful in decoding around 1/6th or so, to raster data
successfully, i.e. the top part of the page is being rendered
successfully, while the rest is not rendered.

(I use GIMP to open the output raster file in RAW mode).

I have attached a screenshot of the output file that I'm able to view
through GIMP (scaled down version).

Is my algorithm wrong? Or are the specs incorrect?

Regards.

_________________________________________________

Roy Samuel | Celstream Technologies | www.celstream.com
<http://www.celstream.com/> 

-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 

________________________________________________________________________
______
 DISCLAIMER: This electronic message and any attachments to this
electronic
 message is intended for the exclusive use of the addressee(s) named
herein
 and may contain legally privileged and confidential information. It is
the 
 property of Celstream Technologies Pvt Limited. If you are not the
intended
 recipient, you are hereby strictly notified not to copy, forward,
distribute
 or use this message or any attachments thereto. If you have received
this
 message in error, please delete it and all copies thereof, from your
system
 and notify the sender at Celstream Technologies or 
 [email-masked] immediately.
________________________________________________________________________
______

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
ipp mailing list
[email-masked]
https://www.pwg.org/mailman/listinfo/ipp

---

From: Michael Sweet <[email-masked]>
Date: Wed, 04 May 2011 13:17:10 -0700

It should be 8-bits per pixel. I'm working on regenerating the files...

On May 4, 2011, at 12:57 PM, Petrie, Glen wrote:

> I was looking some of the PWGR images you provided.  I expected the sgray-8 to have 8 bits/color and 8 bits/pixel but the file shows 24 bits/pixel.  Which is correct?
>  
> Glen
>  
>  
> From: [email-masked] [mailto:[email-masked]] On Behalf Of Roy Samuel
> I had downloaded the sample PWGRaster files from:http://ftp.easysw.com/pub/cups/examples/PWGRasterSamples.zip, with your latest working draft of the PWG raster found at: ftp://ftp.pwg.org/pub/pwg/ipp/wd/wd-ippraster10-20110327-rev.pdf. I compared the raster files in the folders:
> I found that neither of the directories contained files that adhered to the draft document w.r.t parsing the header. Specifically for the value of ‘NumColors’.
>  
> --1--
> According to the draft document, bytes 420-423 need to contain ‘NumColors’ value, however, I found them to be zero. Are the sample files outdated??
>  
> --2--
> Based on the decode algorithm given in the draft document, I had tried to obtain plain RGB raster data from a pwg-raster file. I had converted the PDF document obtained here:http://orenyomtov.com/downloads/testpage.pdf to obtain pwg-raster file using Google cloud print. I am able to get the pwg-raster file from GCP successfully. However, on converting the pwg-raster file to RGB data,  I have been successful in decoding around 1/6th or so, to raster data successfully, i.e. the top part of the page is being rendered successfully, while the rest is not rendered.
> I have attached a screenshot of the output file that I’m able to view through GIMP (scaled down version).
>  
> ______________________________________________________________________________
>  DISCLAIMER: This electronic message and any attachments to this electronic
>  message is intended for the exclusive use of the addressee(s) named herein
>  and may contain legally privileged and confidential information. It is the 
>  property of Celstream Technologies Pvt Limited. If you are not the intended
>  recipient, you are hereby strictly notified not to copy, forward, distribute
>  or use this message or any attachments thereto. If you have received this
>  message in error, please delete it and all copies thereof, from your system
> ______________________________________________________________________________

________________________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair

---

From: "Roy Samuel" <[email-masked]>
Date: Thu, 5 May 2011 10:12:19 +0530

Hi Michael,

Thanks for your reply. 

I have been able to parse the PWG-raster file successfully to obtain
plain RGB data - but only from the one, present in the directory
"PWGRasterSamples" obtained from :
http://ftp.easysw.com/pub/cups/examples/PWGRasterSamples.zip

The specific PWG raster file used is : "img_6461.jpg-srgb-8-150dpi.pwg"

I was able to write the parser based on the specifications described in
the PWG draft document.

I tried using "Rasterview" from http://www.easysw.com/~mike/rasterview/
running on Ubuntu 10.10, to open the file mentioned above,
"img_6461.jpg-srgb-8-150dpi.pwg". I received an error, "Unable to read
page data: Resource temporarily unavailable"

Using the tools/maketestfiles.sh, I was able to create a raster file
with magic number, "3SaR" and not "RaS2", which I don't think is a PWG
raster (?). I used the pstoraster filter. This generated file opens fine
with RasterView v1.2.1. , FYI.

I was able to "/fetch" a pwg raster file from Google Cloud Print (GCP),
by creating a print job from a pdf file. (location of pdf file:
ftp://ftp.pwg.org/pub/pwg/ipp/wd/wd-ippraster10-20110327-rev.pdf). I was
not able to open this PWG raster file, with RasterView, nor was I able
to parse this file completely using the parser that was developed based
on PWG draft specifications. (I was able to obtain about 1/6th of the
file converted to RGB data successfully, the rest - was not decoded, and
appeared as '0x00' for the remainder of the raster data.)

Are there different versions of the PWG raster file?

Perhaps GCP is not using the latest PWG specifications? 

Is RasterView not updated to parse the latest PWG files?

Regards,

Roy Samuel.

From: Michael Sweet [mailto:[email-masked]] 
Sent: Sunday, May 01, 2011 6:02 AM
To: Roy Samuel
Cc: [email-masked]
Subject: Re: Question on PWG draft specification mismatch & parsing

On Apr 28, 2011, at 9:46 PM, Roy Samuel wrote:

	...

	I found that neither of the directories contained files that
adhered to the draft document w.r.t parsing the header. Specifically for
the value of 'NumColors'.

	--1--

Not exactly outdated, just the code that generated them (and the page
headers) contains an error. I will post updates next week.

	--2--

	...

	I have attached a screenshot of the output file that I'm able to
view through GIMP (scaled down version).

I would suspect the former since the compression code that generated the
files has been in use for many years now.

Another tool you can use is RasterView, available here (with source):

    http://www.easysw.com/~mike/rasterview/

__________________________________________________

---

From: Michael Sweet <[email-masked]>
Date: Thu, 05 May 2011 08:00:03 -0700

Roy,

I'll look into the issues with RasterView - it is possible I need to update the binaries (they haven't been updated in 4 years) and Ubuntu may not have updated their CUPS with the latest raster fixes, either...

More comments inline...

On May 4, 2011, at 9:42 PM, Roy Samuel wrote:
> ...
> Using the tools/maketestfiles.sh, I was able to create a raster file with magic number, “3SaR” and not “RaS2”, which I don’t think is a PWG raster (?). I used the pstoraster filter. This generated file opens fine with RasterView v1.2.1. , FYI.

"3SaR" is a version 3 CUPS Raster file in little-endian byte order. The "maketestfiles.sh" script doesn't have support for generating version 2 CUPS Raster files in big-endian byte order, as that requires support in Ghostscript (patch to be submitted Real Soon Now), cgpdftoraster, or the rastertopwg filter from CUPS 1.5.

I'll see about adding support for that.

> I was able to “/fetch” a pwg raster file from Google Cloud Print (GCP), by creating a print job from a pdf file. (location of pdf file:ftp://ftp.pwg.org/pub/pwg/ipp/wd/wd-ippraster10-20110327-rev.pdf). I was not able to open this PWG raster file, with RasterView, nor was I able to parse this file completely using the parser that was developed based on PWG draft specifications. (I was able to obtain about 1/6th of the file converted to RGB data successfully, the rest – was not decoded, and appeared as ‘0x00’ for the remainder of the raster data.)

Again, it could be that RasterView needs to be re-built for the latest Ubuntu, perhaps using the latest CUPS raster sources (instead of relying on the system-supplied CUPS).
 
> Are there different versions of the PWG raster file?

No, although what shows up in the page header has been changing as we continue to define/refine the subset.

> Perhaps GCP is not using the latest PWG specifications?

I can't say - Google would be the one to ask specifically about this, but last time I checked it was working properly (I will see about doing some regular testing with them...)