reddit / emacs

PDF appears very dark when viewed in DocView on MacOS

ajaymt · 2022-02-16 20:49
When I view PDFs in Emacs using DocView, they appear much darker than they should: ​ [Emacs and Preview displaying the same PDF, where it is much darker in Emacs](https://preview.redd.it/3ej89u28d9i81.png?width=2880&format=png&auto=webp&s=57ee4ab626962e5508ac169887a1933a1e99cf6f) I am not sure why this happens -- I haven't changed any settings related to DocView or enabled any minor modes that would cause this. Disabling my current emacs config (by moving .emacs.d) does not resolve this. I am using the mituharu emacs-mac port from [this](https://github.com/railwaycat/homebrew-emacsmacport) Homebrew formula, but the issue also exists with the build from [https://emacsformacosx.com](https://emacsformacosx.com). My .emacs.d is on GitHub [here](https://github.com/AjayMT/.emacs.d). Has anyone encountered a similar issue before? How would I go about resolving this? UPDATE: I found out that the issue is caused by GhostScript, as expressed in [this](https://old.reddit.com/r/emacs/comments/su610o/pdf_appears_very_dark_when_viewed_in_docview_on/hx8tike/) comment. I've resolved it by installing mupdf (`brew install mupdf`), which should cause docview to use `mudraw` to convert PDFs to temporary PNGs instead of GhostScript. After installing mupdf, opening a PDF in DocView and running `doc-view-clear-cache` should resolve the issue.
HM0880 · 2022-02-16 22:30
Just checking: is `pdf-view-midnight-minor-mode` enabled?
rfeynman42 · 2022-02-16 22:59
This suddenly happened to my DocView today too... glad I'm not crazy! I have no clue what caused it, but it seems like much of the white background in my pdfs is now rendered as grey.
rfeynman42 · 2022-02-16 23:01
Thinking about it again now, this makes me think it's somehow a consequence of Homebrew auto updating something — maybe something like `dvipdf` has had an update recently?
ajaymt · 2022-02-16 23:02
Nope, I am using DocView and not pdf-tools
ajaymt · 2022-02-16 23:03
I suspect this is the case as well — I’ll look into which packages I’ve upgraded
rfeynman42 · 2022-02-16 23:03
There seems to have been an ImageMagick version that came out today: - https://github.com/Homebrew/homebrew-core/commit/03abe957c52d75f774d7b30be54782367f7cfd0c - https://github.com/Homebrew/homebrew-core/commit/a3fc895805a3191ef8c0a828b33c863842d66b6e I can't test rolling back my ImageMagick version right now, but I'll see if it does anything later today
rfeynman42 · 2022-02-16 23:06
Try rolling back your ImageMagick version!
00-11 · 2022-02-16 23:17
https://emacs.stackexchange.com/q/70573/105
HM0880 · 2022-02-16 23:41
Oh, my mistake; I misread the question.
ajaymt · 2022-02-16 23:42
Yep that’s me 😅
ajaymt · 2022-02-16 23:59
Tried rolling back by installing [imagemagick@6](https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick@6.rb) but that didn't help :(
ajaymt · 2022-02-17 00:20
Ok I've figured out that the issue is caused by GhostScript. This is the command that DocView runs to convert each PDF page to a png: gs -dSAFER -dNOPAUSE -sDEVICE=png16m -dTextAlphaBits=4 -dBATCH -dGraphicsAlphaBits=4 -dQUIET -r100 -sOutputFile=out.png in.pdf You can try this and check if it outputs a grey PNG like the one you see in emacs -- that's what I'm seeing