Skip navigation
rff-24
Currently Being Moderated

I can't seem to get smasks to work.

May 30, 2013 1:50 PM

I have an image object listed below. It is a 3 X 3 bitmap with all pixels black except the top left is red, middle is green, and bottom right is blue.

 

7 0 obj

<<

/Type /XObject

/Subtype /Image

/ColorSpace /DeviceRGB

/Height 3

/Width 3

/BitsPerComponent 8

/Smask 6 0 R

/Length 55

/Filter /ASCIIHexDecode

>>

stream

ff000000000000000000000000ff000000000000000000000000ff>

endstream

endobj

 

It refers to an Smask listed below:

 

6 0 obj

<<

/Type /XObject

/Subtype /Image

/ColorSpace /DeviceGray

/Height 3

/Width 3

/BitsPerComponent 1

/Length 19

>>

stream

0 0 0 1 1 1 0 0 0 >

endstream

endobj

 

The result shows no transparency, it is all black with the red, green, blue diagonals. Is there something obvious I am not doing right?  I am really new to this. I started a couple of weeks ago by reading "PDF Explained" but that doesn't handle Smask, so I am reading the Adobe documentation.

 

The entire file, if needed is shown below:

 

%PDF-1.7

3 0 obj

<</Type /Page

/Parent 1 0 R

/Resources 2 0 R

/Contents 4 0 R>>

endobj

4 0 obj

<</Length 142>>

stream

  1. 1.0 w

BT /F1 10.00 Tf ET

BT 20.00 470.00 Td (Testing a bitmap image 2) Tj ET

q

1 0 0 1 50.000 50.000 cm

  1. 10.000 0 0 10.000 0 0 cm

/image0 Do

Q

 

endstream

endobj

1 0 obj

<</Type /Pages

/Kids [3 0 R ]

/Count 1

/MediaBox [0 0 500.00 500.00]

>>

endobj

5 0 obj

<</Type /Font

/BaseFont /Helvetica

/Subtype /Type1

/Encoding /WinAnsiEncoding

>>

endobj

6 0 obj

<<

/Type /XObject

/Subtype /Image

/ColorSpace /DeviceGray

/Height 3

/Width 3

/BitsPerComponent 1

/Length 19

>>

stream

0 0 0 1 1 1 0 0 0 >

endstream

endobj

7 0 obj

<<

/Type /XObject

/Subtype /Image

/ColorSpace /DeviceRGB

/Height 3

/Width 3

/BitsPerComponent 8

/Smask 6 0 R

/Length 55

/Filter /ASCIIHexDecode

>>

stream

ff000000000000000000000000ff000000000000000000000000ff>

endstream

endobj

2 0 obj

<<

/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]

/Font <<

/F1 5 0 R

>>

/XObject <<

/image0 7 0 R

>>

/ExtGState <<

/gs0 << /ca 1.000 >>

/gs1 << /CA 1.000 >>

>>

/Shading <<

>>

>>

endobj

8 0 obj

<<

/Producer (rffPdf 1)

/CreationDate (D:20130530144053)

>>

endobj

9 0 obj

<<

/Type /Catalog

/Pages 1 0 R

/OpenAction [3 0 R /FitH null]

/PageLayout /OneColumn

>>

endobj

xref

0 10

0000000000 65535 f

0000000278 00000 n

0000000859 00000 n

0000000009 00000 n

0000000087 00000 n

0000000365 00000 n

0000000461 00000 n

0000000624 00000 n

0000001051 00000 n

0000001126 00000 n

trailer

<<

/Size 10

/Root 9 0 R

/Info 8 0 R

>>

startxref

1229

%%EOF

 
Replies
  • Currently Being Moderated
    May 30, 2013 2:01 PM   in reply to rff-24

    A PDF is a binary file, so posting text like this isn't helpful.

     

    Offhand, an Smask needs to be 8 BPC since it's a 0-255/float value.

     
    |
    Mark as:
  • Currently Being Moderated
    May 30, 2013 2:35 PM   in reply to rff-24

    BitsPerComponent equal 1 is perfectly valid (though it will amount to on or off, whereas more bits gives you an intermediate opacity effect).

     

    But I think you want to write

     

    /SMask

     

    rather than

     

    /Smask

     

     

    Olaf

     
    |
    Mark as:
  • Currently Being Moderated
    May 30, 2013 2:35 PM   in reply to rff-24

    I don't feel that making PDFs in a text editor is useful, even if you can fix it; might as well start as you mean to go on, generating in software.

     

    I do not generally look at text fragments or text renderings of PDF, I don't find it a constructive way to solve problems, as so many problems can be caused or introduced by bad xref addresses. However, it looks as if you have overlooked that all PDF names are case sensitive.

     
    |
    Mark as:
  • Currently Being Moderated
    May 30, 2013 2:36 PM   in reply to Test Screen Name

    By the way, all image data for most colour spaces typically varies from 0 to 1. It is the job of the Decode array (actual or defaulted) to convert your sample integers into that range.

     
    |
    Mark as:
  • Currently Being Moderated
    May 31, 2013 12:51 PM   in reply to olafdruemmer

    I was doing the following wrong:

     

    1. I had /Smask instead of /SMask

    2. The alpha data I have comes from a canvas image, so it is between 0 and 255, so I needed to use

       /Filter   /ASCIIHexDecode

       /BitsPerComponent 8

     

    Then things started working! Thanks for your help!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points