dopod0901 2016-09-18 00:23
浏览 91

颜色为黑白,从PDF到IMG再到PDF

Ok, so I am taking full color PDFs and trying to convert them to black and white images to then make them black and white PDF's.

Currently I am attempting to do this with imagemagick and i am for the most part successful with breaking them PDF into separate images. However once creating the separate images I want to make full size black and white copies next to the color copies as well as thumbnails thereof of both. Which that part I feel I'll be able to figure out on my own.

What I am having trouble figuring out is how to get them to become black and white. Not necessarily grayscale, since grayscale will still use colored ink in most printers to come up with the varying shades of gray. From which I am trying to avoid.

Is there a means I can do this with imagemagick or is my thought process all wrong?

Also worth noting is I am trying to do this through a browser and server side process with PHP

  • 写回答

1条回答 默认 最新

  • 普通网友 2016-09-18 09:51
    关注

    I think you are looking for "Two Colour Quamtisation" as described in Anthony Thyssen's excellent work here.

    Basically, you use quantisation to pick the best two colours to represent your image, then force the darker one to black and the lighter one to white. So your processing becomes:

    convert image.png -colors 2 -colorspace gray -normalize result.png
    

    Btw, I presume you found and are using pdfimages (part of the poppler package) to extract the images in original quality.

    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集