Skip to content

invert only the images (not text nor background)<br> [R,G,B]:255-[R,G,B]

Notifications You must be signed in to change notification settings

stT-e5gna2z5MBS/invert-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

invert only the images (not text nor background)
[R,G,B]:255-[R,G,B]

node invert-pdf.mjs yourPDF.pdf

included demo:
node invert-pdf.mjs VyacheslavEgorov_BenchmarkingJavaScript.pdf

output folder tempWork\:
stage 1: decrypted.pdf
stage 2: uncompressed.pdf
stage 3: transformed.pdf
stage 4: fixed.pdf
stage 5: compressed.pdf
(compressed.pdf is what you should take, the rest is for those interested)

summary:

const ok=spawn(`${__dirname}/qpdf`,[pdfName,"--decrypt",`${__dirname}/tempWork/decrypted.pdf`])
const ok=spawn(`${__dirname}/pdftk`,[`${__dirname}/tempWork/decrypted.pdf`,"output",`${__dirname}/tempWork/uncompressed.pdf`,"uncompress"])
const ok=spawn(`${__dirname}/pdfimages`,["-all",`${__dirname}/tempWork/uncompressed.pdf`,"sure"],{cwd:`${__dirname}/tempWork`})
const ok=spawn(`${__dirname}/pdfimages`,["-list",`${__dirname}/tempWork/uncompressed.pdf`])
const ok=spawn(`${__dirname}/magick`,[`${__dirname}/tempWork/${v.basename}.${v.ext}`,"-channel","RGB","-negate",`${__dirname}/tempWork/${v.basename}_negate.${v.ext}`])
const ok=spawn(`${__dirname}/gswin64c`,["-o",`${__dirname}/tempWork/fixed.pdf`,"-sDEVICE=pdfwrite","-dPDFSETTINGS=/prepress",`${__dirname}/tempWork/transformed.pdf`])
const ok=spawn(`${__dirname}/pdftk`,[`${__dirname}/tempWork/fixed.pdf`,"output",`${__dirname}/tempWork/compressed.pdf`,"compress"])

About

invert only the images (not text nor background)<br> [R,G,B]:255-[R,G,B]

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published