Home
 
The page you are viewing is part of our 160,000 page PDF discussion forum archive spanning 1999-2011.
Go to the new Planet PDF forum to join the PDF community.
 

Search
 Advanced   
Sign up for a WebBoard account Archive Forum Home


PLATINUM
SPONSOR


Topic  
Go to previous topicPrev TopicGo to next topicNext Topic
Author Message
needpdfa
needpdfa

Total Messages 4

Subject:How to interpret image using Separated color space?

Hi all,

I'm working on a PDF image extraction solution, I'm using APDFL to extract the raw pixel data, then I build up my BMP file. So far so good, I can handle DeviceRGB, DeviceCMYK, DeviceGray, Indexed. I'm working on Separation now but I'm not quite sure how to interpret it so the resulting image I get isn't quite correct.

The image is from the PDF reference 1.7, page 489, object #1294 so you can see what I'm working with. It's using Separated with an alternate space of CMYK, the name is Black. BitsPerComponent is 8.

I can get the tint transform (type 0 function), but what are my tint values here, are they just my image pixel values? I can use PDApplyFunction() but the documentation is very light here on how to use it.

What I'm doing now is simply using a default grayscale palette (0,1,2,...255) and if you negate the resulting image it's a pretty close approximation but this won't fly in production.

In general what does one do when they need a palette but one isn't found in the xobject's colorspace? (For B&W I can assume the default b&w palette if it's missing.)



Posted: 21 Aug 2011 02:31 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
aandi
aandi

Total Messages 17064

Subject:How to interpret image using Separated color space?

Tint values are always in the range of 0 to 1. As with other image color spaces, you use the Decode array to convert the pixel values (0 to 255 if it is 8 bits per component) to the target range.

If there is no Decode array you must apply the default array, which is different for each color space. This is true of all color spaces, even Indexed where the color space values are 0 to N rather than 0 to 1.

It is common to omit this step and feel that everything is working fine because things work out plausibly in many cases. For instance, a DeviceRGB image with no Decode will have pixel values in the range 0 to 255. The default Decode will map this to values in the range 0 to 1. However, if the image data is to be exported, many image representations simply expect 8 bit values, so the 0 to 1 value would simply be scaled back into the range 0 to 255. But this is just good luck!

A further tip: in general, every pixel value needs to be transformed when extracting pixel data. You can, however, test the combination of ColorSpace, Decode and BitsPerComponent and the required representation to see for which images the conversion would not change anything, and in such cases use the pixel data unchanged.

Then there is the question of the input values to PDApplyFunction. I never used this, having written my own function evaluator, but I agree: the documentation for this seems too sparse to actually use it. Can anyone share insight into its parameters?


Posted: 21 Aug 2011 03:44 AM
Originally Posted: 21 Aug 2011 02:41 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
needpdfa
needpdfa

Total Messages 4

Subject:How to interpret image using Separated color space?

I'm still not clear on what the tint values actually are? (are they the pixel values?)

If you look at the image it's grayscale, 8 bits per component. Now I can get the data out and create a 8-bit BMP, but what's my color table. With an indexed colorspace I can extract the color table from a stream or string. Or should I not be treating this as 8-bit image data?

I was under the impression that if the Decode array was anything other than the default values for the colorspace then I need to apply the decode mapping. You're saying even if it's the default I should still apply it? and if no decode array is present I should apply the default too?


Posted: 22 Aug 2011 09:52 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
aandi
aandi

Total Messages 17064

Subject:How to interpret image using Separated color space?

Yes, the Decode array is a compulsory part of the algorithm, and it or the default should be applied. You will find (and might optimize) the cases where this is a no-operation.

The tint values for a Separation color space are the color values. Apply the Decode and you will get a value in the range 0 to 1, which can be sent into the function to get the colour value(s) in the alternate space. This in turn is processed, much as if it was a lookup in the Indexed palette.

Indeed, for 8 bits per component, you can pre-calculate for the 0 to 255 values that might be found in the image data; in effect you end up with a lookup table and avoid repeated calculation. No such shortcut is available for DeviceN, when you face that.


Posted: 22 Aug 2011 10:26 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
   
Go to previous topicPrev TopicGo to next topicNext Topic

go




Top | News | Developer | Find PDF Tools | Sponsorship | Tips | Home



Debenu's Planet PDF - a comprehensive site exclusively focused on Adobe Acrobat/PDF users and uses. Debenu's Planet PDF - Resources for Adobe Acrobat and PDF users

Please post PDF-related questions to our Planet PDF Forum forums.planetpdf.com. To send comments about this site please visit our contact page.
Planet PDF, Planet PDF Forum, PDF SDK - Debenu Quick PDF Library and Debenu are all copyright
2011 Debenu Pty Ltd.. All Rights Reserved. Privacy policy.