• How to apply color filter to image?

    From intgg3@gmail.com@21:1/5 to All on Tue Jul 3 01:12:30 2018
    I have a gray scale image in pdf. Now I need to apple the red color to the image like the effect of tint color in iOS. I implement the color with /Decode, but it paint the whole image with red, even the blank background. So what's the right code to
    change the tint color of the image? Thanks.

    <</Type/XObject/Subtype/Image/Name/IM0 /Width 128/Height 128/Decode [0.922 0.922 0.122 0.122 0.137 0.137]/SMask 424 0 R/BitsPerComponent 8/ColorSpace/DeviceRGB/Length 2609/Filter/FlateDecode>>
    stream

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ken@21:1/5 to All on Tue Jul 3 10:37:54 2018
    In article <664707f7-d844-4661-8094-edc53d905be6@googlegroups.com>, intgg3@gmail.com says...

    I have a gray scale image in pdf. Now I need to apple the red color to the image like the effect of tint color in iOS. I implement the color with /Decode, but it paint the whole image with red, even the blank background. So what's the right code to
    change the tint color of the image? Thanks.

    <</Type/XObject/Subtype/Image/Name/IM0 /Width 128/Height 128/Decode [0.922 0.922 0.122 0.122 0.137 0.137]/SMask 424 0 R/BitsPerComponent 8/ColorSpace/DeviceRGB/Length 2609/Filter/FlateDecode>>
    stream

    Sounds like the image covers the entire page to me, from your
    description. But since you haven't posted the entire PDF its not
    possible to tell for certain. I'd suggest you put the file somewhere (eg DropBox) and post a URL here.

    Note that your 'gray scale image' includes a transparent Soft Mask,
    which complicates matters somewhat.

    Your Decode array seems to force all the RGB components to R=.922, G=
    0.122, B=0.137 which doesn't seem like the right thing to do, to me,
    presumably you want shades of red, not the entire image set to the smae
    RGB value.

    If you are starting with a gray scale image (so 8 bits per component, 1 component), its probably easiest to use a /Indexed coluor space, and
    have each of the possible 256 gray values in the gray scale map to a
    specific RGB value.


    Ken

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From intgg3@gmail.com@21:1/5 to All on Tue Jul 3 22:41:49 2018
    I have a gray scale image in pdf. Now I need to apple the red color to the image like the effect of tint color in iOS. I implement the color with /Decode, but it paint the whole image with red, even the blank background. So what's the right code to
    change the tint color of the image? Thanks.

    <</Type/XObject/Subtype/Image/Name/IM0 /Width 128/Height 128/Decode [0.922 0.922 0.122 0.122 0.137 0.137]/SMask 424 0 R/BitsPerComponent 8/ColorSpace/DeviceRGB/Length 2609/Filter/FlateDecode>>
    stream

    Sounds like the image covers the entire page to me, from your
    description. But since you haven't posted the entire PDF its not
    possible to tell for certain. I'd suggest you put the file somewhere (eg DropBox) and post a URL here.

    Note that your 'gray scale image' includes a transparent Soft Mask,
    which complicates matters somewhat.

    Your Decode array seems to force all the RGB components to R=.922, G=
    0.122, B=0.137 which doesn't seem like the right thing to do, to me, presumably you want shades of red, not the entire image set to the smae
    RGB value.

    If you are starting with a gray scale image (so 8 bits per component, 1 component), its probably easiest to use a /Indexed coluor space, and
    have each of the possible 256 gray values in the gray scale map to a specific RGB value.


    Ken

    Thank you. Files are here: https://www.dropbox.com/sh/qz6l51aulyfq34l/AACuIMcDatbIWQ5IzdnXsLLqa?dl=0

    wrongred.pdf has the wrong red with /Decode.
    goodtintred.png is the right result to produce.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)