Chuyển đến nội dung

Chuyển PDF sang thang xám

Chuyển một tài liệu màu sang xám, vẫn giữ văn bản tìm kiếm được.

Xử lý trên thiết bị của bạn

Công cụ này chạy hoàn toàn trong trình duyệt của bạn. Tệp của bạn không bao giờ được tải lên, và bạn có thể tự kiểm chứng điều đó trong tab mạng của trình duyệt. Tự kiểm chứng: mở tab mạng của trình duyệt và theo dõi. Bạn sẽ thấy một yêu cầu nhỏ hỏi xem bạn còn tác vụ nào không - một tên công cụ và một mã băm, không bao giờ là tệp.

Công cụ này làm gì

There is no way to recolour a PDF's vector content inside a browser - the colour lives in every content stream, in whichever of five colour spaces the producer chose. So this tool says plainly how it works: each page is re-rendered in grey and the document is rebuilt from the resulting images. The pages stop being vector as a result. The words do not stop being words: the text is read out first and drawn back invisibly over each image, so the document is still selectable and searchable.

The usual reason is printing. Colour pages cost several times what grey ones do on most office and copy-shop tariffs, and many print accounting systems bill by what the file contains rather than by what the driver was set to. It is also a straightforward way to shrink a colour scan.

Cách hoạt động

  1. Drop the PDF onto this page. Files up to 300 MB are accepted.
  2. Set the resolution. 150 dpi is the default and reads well on screen; raise it towards 300 dpi for a document that will be printed and examined closely.
  3. Leave Keep text searchable on unless you have a reason not to - it costs a little size and keeps the document usable.
  4. Adjust the JPEG quality under advanced options if the default of 82 per cent is softer or larger than you want.
  5. Press Convert to grayscale. Progress shows which page is being rendered, and the result reports the resolution used.

The conversion uses Rec. 709 luma rather than the average of the red, green and blue channels. The eye is roughly three times more sensitive to green than to red and ten times more than to blue, so averaging makes a saturated red and a saturated blue come out as the same middle grey when one should be clearly darker. Weighting the channels the way vision does keeps coloured text, chart series and highlighted rows distinguishable after the colour is gone.

Keeping the text searchable is what separates this from printing to an image. Before any page is replaced, PDF.js extracts every text run with its position and size; those runs are then drawn over the finished image in an invisible rendering mode. You can select a paragraph, search for a phrase and copy a table out of the result, even though what you are looking at is a picture.

The file will not always get smaller. A colour scan usually shrinks substantially, because three channels become one and the JPEG has less to encode. A text document made of vector glyphs frequently grows, sometimes several times over, because a page of crisp type is cheaper to store as instructions than as a picture of itself. If your goal is size rather than colour, Compress PDF is the tool to reach for.

Because the pages are rebuilt from images, what sits on top of them does not survive: links stop being clickable, form fields stop being fillable, and comments, highlights and stamps are gone rather than drawn in. If you need the marks kept as marks, flatten the document first and convert afterwards.

Rendering happens on your device with PDF.js and a canvas, and the rebuild with pdf-lib - both in Web Workers, neither over a network. This is the heaviest tool in the category on a large file, and it is still local: a 300-page colour report is rendered page by page in your own browser.

Công cụ này không làm được gì

  • The output is images, not vector pages. Zooming in far enough shows the pixels, and the type is no longer infinitely sharp.
  • A text-heavy document can come out larger than the original, because a page of type stores more cheaply as instructions than as a picture.
  • Links, form fields and annotations are not carried over, since each page is replaced by an image of itself.

Câu hỏi thường gặp

Vì sao nên chuyển tệp thay vì tích chọn thang xám trong hộp thoại in?
Vì hộp thoại in chỉ ảnh hưởng đến lệnh in đó trên chính máy đó. Một tiệm photocopy, một máy in văn phòng dùng chung hay một đồng nghiệp mở tệp sẽ mỗi bên tự quyết định, và nhiều hệ thống tính phí in tính một trang là màu nếu tệp có chứa màu, bất kể trình điều khiển được đặt thế nào. Chuyển đổi bản thân tài liệu sẽ giải quyết dứt điểm một lần.
Tôi mất bao nhiêu chất lượng?
Màu mất đi vĩnh viễn, và các trang trở thành ảnh ở độ phân giải bạn chọn. Ở 150 dpi, kết quả đọc tốt trên màn hình và in được ở mức chấp nhận được; ở 300 dpi, nó là chất lượng in và tệp lớn hơn khoảng bốn lần. Lớp văn bản được giữ lại trong cả hai trường hợp.
Tệp có nhỏ hơn không?
Một bản quét màu thường nhỏ đi rất nhiều. Một tài liệu văn bản lại thường phình ra, vì kết xuất chữ vào một JPEG tốn nhiều hơn các câu lệnh đã vẽ ra nó. Cả hai kết quả đều được báo dưới dạng kích thước trước và sau, nên bạn có thể thấy mình rơi vào trường hợp nào và giữ lại bản gốc nếu nó không như bạn muốn.
Sau đó tôi vẫn tìm kiếm và chọn văn bản được chứ?
Có, miễn là Giữ văn bản tìm kiếm được đang bật. Văn bản được trích xuất trước khi các trang bị thay thế và được vẽ lại vô hình lên trên các ảnh, nên chọn, tìm kiếm và sao chép đều vẫn hoạt động. Nếu bản gốc vốn là một bản quét không có lớp văn bản ngay từ đầu thì chẳng có gì để giữ lại - hãy chạy OCR PDF trước.
Tài liệu có được tải lên để kết xuất không?
Không. Mỗi trang được PDF.js kết xuất lên một canvas ngay trong trình duyệt của bạn và được pdf-lib ghép lại trong một Web Worker. Không có gì được truyền đi, điều đó cũng có nghĩa là tốc độ phụ thuộc vào thiết bị của bạn chứ không phải vào một hàng chờ ở đâu đó.

Công cụ liên quan