Discussion:
Color image to B/W or RGB to CMYK
(too old to reply)
MadYuv
2017-04-08 08:14:24 UTC
Permalink
Raw Message
Is this possible to turn all color images to B/W or to turn all RGB to CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX without touching the images...pl share all your thoughts...
MadYuv
2017-04-09 14:15:52 UTC
Permalink
Raw Message
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX without touching the images...pl share all your thoughts...
please help me to sortout my issue...
Leon van Dommelen
2017-04-15 14:18:17 UTC
Permalink
Raw Message
Post by MadYuv
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to
CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX
without touching the images...pl share all your thoughts...
please help me to sortout my issue...
https://www.adobe.com/products/postscript/pdfs/PLRM.pdf section 4.10
shows what postscript can do. Maybe you can implement something using
specials?

Just an idea. I would not know how to do it myself; I would just
convert the images.

Leon
MadYuv
2017-04-18 07:18:30 UTC
Permalink
Raw Message
Post by Leon van Dommelen
Post by MadYuv
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to
CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX
without touching the images...pl share all your thoughts...
please help me to sortout my issue...
https://www.adobe.com/products/postscript/pdfs/PLRM.pdf section 4.10
shows what postscript can do. Maybe you can implement something using
specials?
Just an idea. I would not know how to do it myself; I would just
convert the images.
Leon
Thanks for your update, will check and get back...
k***@gmail.com
2017-04-19 00:49:37 UTC
Permalink
Raw Message
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX without touching the images...pl share all your thoughts...
an answer for color images to black and white is given on TeX StackExchange:

https://tex.stackexchange.com/questions/125576/png-figures-in-black-and-white

Try: dvips -I g <filename>

the "g" stands for grayscale. regards from corporal
MadYuv
2017-04-19 04:51:46 UTC
Permalink
Raw Message
Post by k***@gmail.com
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX without touching the images...pl share all your thoughts...
https://tex.stackexchange.com/questions/125576/png-figures-in-black-and-white
Try: dvips -I g <filename>
the "g" stands for grayscale. regards from corporal
Following error happened if I tried with the suggestion:

dvips: ! Invalid option `-I'. Try --help for more information.

And my LaTeX code follows:

\documentclass{book}
\usepackage{color,graphicx}
\begin{document}

\begin{figure}
\centerline{\includegraphics{Color.eps}}
\end{figure}

\end{document}

I am using MikTeX Version 2.9 (Version 3.14159265-2.6-1.40.17 [MiKTeX 2.9.6210])

Please suggest what went wrong....
k***@gmail.com
2017-04-19 05:41:24 UTC
Permalink
Raw Message
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX without touching the images...pl share all your thoughts...
Yes, my suggestion was not correct. I tested dvips -I g <filename> after your reply and got the invalid option error message. You may need to use a graphic program to do the conversion from color to B/W (grayscale).
regards from corporal
Herbert Voss
2017-04-23 19:48:18 UTC
Permalink
Raw Message
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX without touching the images...pl share all your thoughts...
\documentclass{book}
\usepackage{color,graphicx}
\AtBeginDocument{\special{ps:
true setglobal globaldict begin
/setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray }
def
end false setglobal
}}
\begin{document}

\includegraphics[scale=0.5]{tiger.eps}
\newpage
\includegraphics[scale=0.5]{tiger.eps}

\end{document}

With the globaldict it works only for the first image.
It needs latex->dvips->ps2pdf


Herbert
Herbert Voss
2017-04-24 07:43:41 UTC
Permalink
Raw Message
Post by MadYuv
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to
CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX
without touching the images...pl share all your thoughts...
\documentclass{book}
\usepackage{color,graphicx}
true setglobal globaldict begin
/setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray } def
end false setglobal
}}
\begin{document}
\includegraphics[scale=0.5]{tiger.eps}
\newpage
\includegraphics[scale=0.5]{tiger.eps}
\end{document}
With the globaldict it works only for the first image.
read "without" ...

Herbert
Post by MadYuv
It needs latex->dvips->ps2pdf
MadYuv
2017-04-27 07:27:23 UTC
Permalink
Raw Message
Post by Herbert Voss
Post by MadYuv
Post by MadYuv
Is this possible to turn all color images to B/W or to turn all RGB to
CMYK while doing DVI2PS conversion (using dvips) or through PDFLaTeX
without touching the images...pl share all your thoughts...
\documentclass{book}
\usepackage{color,graphicx}
true setglobal globaldict begin
/setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray } def
end false setglobal
}}
\begin{document}
\includegraphics[scale=0.5]{tiger.eps}
\newpage
\includegraphics[scale=0.5]{tiger.eps}
\end{document}
With the globaldict it works only for the first image.
read "without" ...
Herbert
Post by MadYuv
It needs latex->dvips->ps2pdf
Sorry, I didn't check the suggestion, hence I was not well for the past days, still the color images didn't change to B/W, my coding follow:

\documentclass{book}
\usepackage{color,graphicx}
\AtBeginDocument{\special{ps:
true setglobal globaldict begin
/setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray }
def
end false setglobal
}}
\begin{document}

\begin{figure}
\centerline{\includegraphics{colorrgbmake.eps}}
\end{figure}

\clearpage

\begin{figure}
\centerline{\includegraphics{colorrgbmake.eps}}
\end{figure}


\end{document}

dvips filename.dvi
ps2pdf filename.ps
Herbert Voss
2017-04-27 07:30:48 UTC
Permalink
Raw Message
Post by MadYuv
\centerline{\includegraphics{colorrgbmake.eps}}
can you provide that eps for a test?

Herbert
MadYuv
2017-04-27 08:38:41 UTC
Permalink
Raw Message
Post by Herbert Voss
Post by MadYuv
\centerline{\includegraphics{colorrgbmake.eps}}
can you provide that eps for a test?
Herbert
Sent to your mail...
Herbert Voss
2017-04-27 09:45:15 UTC
Permalink
Raw Message
Post by Herbert Voss
Post by MadYuv
\centerline{\includegraphics{colorrgbmake.eps}}
can you provide that eps for a test?
The problem is the figure environment, it doesn't use the
global definitions. Set the gray conversion also inside
that environment. You can redefinie the figure environment
that it does it by default.

this works:

\documentclass{book}
\usepackage{graphicx}
\def\setGray{\special{ps:
true setglobal globaldict begin
/setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray
} def
end false setglobal
}}
\AtBeginDocument{\setGray}
\begin{document}
\begin{figure}
\setGray
\centerline{\includegraphics{colorrgbmake2.eps}}
\end{figure}

\clearpage

\begin{figure}
\setGray
\centerline{\includegraphics{colorrgbmake2.eps}}
\end{figure}

\end{document}

Herbert
s***@gmail.com
2017-04-27 12:54:05 UTC
Permalink
Raw Message
Post by Herbert Voss
Post by Herbert Voss
Post by MadYuv
\centerline{\includegraphics{colorrgbmake.eps}}
can you provide that eps for a test?
The problem is the figure environment, it doesn't use the
global definitions. Set the gray conversion also inside
that environment. You can redefinie the figure environment
that it does it by default.
\documentclass{book}
\usepackage{graphicx}
true setglobal globaldict begin
/setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray } def
end false setglobal
}}
\AtBeginDocument{\setGray}
\begin{document}
\begin{figure}
\setGray
\centerline{\includegraphics{colorrgbmake2.eps}}
\end{figure}
\clearpage
\begin{figure}
\setGray
\centerline{\includegraphics{colorrgbmake2.eps}}
\end{figure}
\end{document}
Herbert
It works fine, thanks a lot for your great help....
Axel Berger
2017-04-27 17:23:18 UTC
Permalink
Raw Message
Post by s***@gmail.com
It works fine, thanks a lot for your great help....
Just a rough outline of the way I tend to go about these things in the
hope, someone might find it useful:

Run an editor script over the logfile to extract all images loaded and
make that list into a batch command file.
Then run that batch to repeatedly call up a graphics program to alter
the images as needed and save them in a separate directory.
Last set \graphicspath to look in that directory first.

I use it often, if not for your task specifically. If that sounds too
complicated then take a look at the package pdflatexpicscale by Peter
Willadt.
Contrary to my proprietary solution it conforms to LaTeX standards but
it's less flexible and you'd probably need the author's help to adapt it
to your needs.

Axel
--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --
s***@gmail.com
2017-05-04 10:34:00 UTC
Permalink
Raw Message
Post by Herbert Voss
Post by Herbert Voss
Post by MadYuv
\centerline{\includegraphics{colorrgbmake.eps}}
can you provide that eps for a test?
The problem is the figure environment, it doesn't use the
global definitions. Set the gray conversion also inside
that environment. You can redefinie the figure environment
that it does it by default.
\documentclass{book}
\usepackage{graphicx}
true setglobal globaldict begin
/setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray } def
end false setglobal
}}
\AtBeginDocument{\setGray}
\begin{document}
\begin{figure}
\setGray
\centerline{\includegraphics{colorrgbmake2.eps}}
\end{figure}
\clearpage
\begin{figure}
\setGray
\centerline{\includegraphics{colorrgbmake2.eps}}
\end{figure}
\end{document}
Herbert
Is this possible to fix the same option in PDFLaTeX (images are in png, jpg, pdf formats)
Loading...