Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
Ghostscript : Filter out image streams by criteria

I have pdf files created on Adobe InDesign, which contains several kinds of object.

I wish to "Remove everything except the largest art (background)" and save to a new file.

This can be achieved almost perfectly with combination of gs command options like this:

$ gs -q -o "${outfile}" -sDEVICE=pdfwrite -dFILTERTEXT -dFILTERVECTOR "${infile}"

However, occasionally there are several raster images which I'd like to filter by some criteria. The image I wish to keep, always have following properties that distinguish it from the unwanted ones:

  • it is always the largest in data size
  • it is always the largest by dimension
  • it is always a 1bit binary images, sometimes compressed with CCITT g4 or LZW

Is there a way to filter certain images by criteria, by using gs command or any other tools perhaps?

This link guided me to using the filter options, but could not work out how I could extend the functionality further: How can I remove all images from a PDF?

The code runs on a Mac/Ubuntu envrironment.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!