Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6074059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:20:24+00:00 2026-05-23T10:20:24+00:00

I read Create a tiff with only text and no images from a postscript

  • 0

I read Create a tiff with only text and no images from a postscript file with ghostscript and try to use KenS`s answer.
But this method remove only “black” images – image contain data only in black channel (PDF has colorspace CMYK). How can i remove all images in my case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:20:24+00:00Added an answer on May 23, 2026 at 10:20 am

    This does a better job, but its incomplete. It doesn’t deal with images using multiple data sources for example. Its essentially untested, except that I did test your smaller file (pages.pdf) by using ps2write to convert to PostScript and then the PostScript program below, and teh pdfwrite device, to convert back to PDF.

    One of the first things you will notice is that almost all the text has vanished from your document. That’s because the fonts you are using are bitmap fonts, and the program can’t tell the difference between a bitmap representing a character, and any other kind of bitmap. For this file you can solve that by removing the definition of imagemask because all the characters use imagemask, and the other images use ‘image’.

    I have a sneaky suspicion the formatting of the program is going to get messed up here 🙁

    8<------------------------------8<--------------------------8<-------------------------
    %!
    
    % 
    % numbytes -file- ConsumeFileData -
    %
    /ConsumeFileData {
      userdict begin
      /DataString 256 string def
      /DataFile exch def
      /BytesToRead exch def
    
    %(BytesToRead = ) print BytesToRead ==
      mark
      {
        DataFile DataString readstring {                    % read bytes
          /BytesToRead BytesToRead 256 sub def              % not EOF subtract 256 from required amount.
    %(Read 256 bytes) ==
    %(BytesToRead now = ) print BytesToRead ==
        } {
          length 
    %(Read ) print dup 256 string cvs print (bytes) ==
          BytesToRead exch sub /BytesToRead exch def % Reached EOF, subtract length read froom required amount
    %(BytesToRead now = ) print BytesToRead ==
          exit                                              % and exit loop 
        } ifelse
      } loop
    
    %BytesToRead ==
      BytesToRead 0 gt {
        (Ran out of image data reading from DataSource\n) ==
      } if
      cleartomark
      end
    } bind def
    
    % 
    % numbytes -proc- ConsumeProcData -
    %
    /ConsumeProcData {
    userdict begin
      /DataProc exch def
      /BytesToRead exch def
    
      {
        DataProc exec                                     % returns a string
        length BytesToRead exch sub                       % subtract # bytes read
        /BytesToRead exch def
        BytesToRead 0 le {
          exit                                            % exit when read enough
        } if
      } loop
    end
    } bind def
    
    /image {
     (image) ==
     dup type /dicttype eq { 
      dup /MultipleDataSources known {
        dup /MultipleDataSources get {
          (Can't handle image with multiple sources!) ==
        } if
      } if
      dup /Width get                 % stack = -dict- width
      exch dup /BitsPerComponent get % stack = width -dict- bpc
      exch dup /Decode get           % stack = width bpc -dict- decode
      length 2 div                   % decode = 2 * num components
      exch 4 1 roll                  % stack = -dict- width bpc ncomps
      mul mul                        % stack = -dict- width*bpc*ncomps
      7 add cvi 8 idiv               % stack = -dict- width(bytes) 
      exch dup /Height get           % stack = width -dict- height
      exch /DataSource get           % stack = width height DataSource
      3 1 roll                       % stack = DataSource width height
      mul                            % stack = DataSource widht*height
      exch                           % stack = size DataSource
     } {
      5 -1 roll 
      pop                       % throw away matrix
      mul mul                   % bits/sample*width*height
      7 add cvi 8 idiv          % size in bytes of data floor(bits+7 / 8)
      exch                      % stack = size DataSource
     } ifelse
    
     dup type /filetype eq { 
      ConsumeFileData
     } {
       dup type /arraytype eq or
       1 index type /packedarraytype eq or {
        ConsumeProcData
       } {
        pop pop                  % Remove DataSource and size
       } ifelse
     } ifelse
    } bind def
    
    /imagemask {
    (imagemask)==
     dup type /dicttype eq { 
      dup /MultipleDataSources known {
        dup /MultipleDataSources get {
          (Can't handle imagemask with multiple sources!) ==
        } if
      } if
      dup /Width get                 % stack = -dict- width
      7 add cvi 8 idiv             % size in bytes of width floor(bits+7 / 8)
      exch dup /Height get           % stack = width -dict- height
      exch /DataSource get           % stack = width height DataSource
      3 1 roll                       % stack = DataSource width height
      mul                            % stack = DataSource width*height
      exch                           % stack = size DataSource
     } {
      5 -1 roll 
      pop                       % throw away matrix
      mul mul                   % bits/sample*width*height
      7 add cvi 8 idiv          % size in bytes of data floor(bits+7 / 8)
      exch                      % stack = size DataSource
     } ifelse
    
     dup type /filetype eq { 
      ConsumeFileData
     } {
       dup type /arraytype eq or
       1 index type /packedarraytype eq or {
        ConsumeProcData
       } {
        pop pop                  % Remove DataSource and size
       } ifelse
     } ifelse
    } bind def
    
    /colorimage {
    (colorimage)==
      dup 1 ne {
        1 index
        {
          (Can't handle colorimage with multiple sources!) ==
        } if
      } {
        exch pop                   % get rid of 'multi'
                       % stack: w h bpc m d ncomp
        3 -1 roll pop              % stack: w h bpc d ncomp
        exch 5 -1 roll             % stack d w h bpc ncomp
        mul mul mul                % stack: d w*h*bpc*ncomp
        7 add cvi 8 idiv exch      % stack: bytes datasource
      } ifelse
    
     dup type /filetype eq { 
      ConsumeFileData
     } {
       dup type /arraytype eq or
       1 index type /packedarraytype eq or {
        ConsumeProcData
       } {
        pop pop                  % Remove DataSource and size
       } ifelse
     } ifelse
    } bind def
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create classes to read from my config file using ConfigurationSection and
I'm trying to create a Zip file from .Net that can be read from
I'm trying to create a TCP connection and send/read data that uses SSL, but
I need to create XML in Perl. From what I read, XML::LibXML is great
I'm trying to open a file and create a list with each line read
What is a good way to create and read an OpenOffice spreadsheet in Perl?
how can i create an application to read all my browser (firefox) history? i
I want to read, write and create Spreadsheets in the Open Document Format with
I read in this article that a company has created a software capable of
Any advice on how to read auto-incrementing identity field assigned to newly created record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.