タイトルの色を画像の背景に置き換える

タイトルの色を画像の背景に置き換える

これは次の質問に対するフォローアップです画像をPSpictureに完璧にフィットさせる便利な方法

コードを検討する

\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{pstricks,psvectorian}
\usepackage{scalerel} % For Vertical Stretch of Letters
\usepackage{graphicx}
\usepackage{color}

% Overlay Title
\newcommand{\mytitle}[1]% #1 = title
{\bgroup
  \Huge
  \sbox0{\parbox{\columnwidth}{\centering\textbf{\color{black}#1}}}%
  \sbox1{\parbox{\columnwidth}{\centering\textbf{\color{white}#1}}}%
  \usebox0\llap{\raisebox{1.45pt}{\usebox1}}
\egroup}

\begin{document}
\thispagestyle{empty}

\begin{pspicture}(-5,-5)(5,12)%
\psframe[linecolor=black,linewidth=4pt](-5,-5)(5,12)% 
\rput(0,3.5){\includegraphics[width=.87\linewidth,height=1.49\linewidth]{example-image-a}}
\end{pspicture}

\newpage
\thispagestyle{empty}

\begin{pspicture}(-5.09,-5.09)(5.09,12.09)%
\renewcommand*{\psvectorianDefaultColor}{yellow!65!red}%
\psframe[fillcolor=yellow!65!red,fillstyle=solid](-5,-5)(5,12) 
\psframe[linecolor=black,linewidth=4pt](-5.09,-5.09)(5.09,12.09)% 

% TITLE 
\rput(0,6.25){\vstretch{1.25}{\mytitle{CUT-OUT TITLE}}}
\rput(0,5){\vstretch{1.25}{\mytitle{AND PLACE}}}
\rput(0,3.75){\vstretch{1.25}{\mytitle{OVER IMAGE}}}
\end{pspicture}%
\end{document}

2ページの出力を生成する

ここに画像の説明を入力してください

ここに画像の説明を入力してください

質問:3本の線を効果的に切り取るにはどうすればいいでしょうか?白い部分ページ 1 のタイトルをpspicture削除し、それをpspictureページ 1 の画像に重ねると、pspictureタイトルが白ではなくなり、背景にページ 1 の画像が含まれるページ 2 が表示されます。
注記:によって生成された元の黒いオーバーレイは、\mytitle修正された にも表示されたままになりますpspicture

答え1

のみで動作しますlatex->dvips->ps2dpf

\documentclass{book}
\usepackage{pstricks}
\usepackage{graphicx}
\usepackage{pst-char}
\DeclareFixedFont{\RM}{T1}{ptm}{b}{n}{2cm}
\begin{document}

\begin{pspicture}(-5,-5)(5,12)%
\begin{pscharclip}[linewidth=0.1pt]{\rput(0,3.5){\RM\shortstack{Cut-out title\\line 2\\line 3}}}%
\rput[lb](-5,-5){\includegraphics[width=10cm,height=17cm]{example-image-a}}
\end{pscharclip}
%\psframe[linecolor=black,linewidth=4pt,dimen=inner](-5,-5)(5,12)% 
\end{pspicture}

\end{document}

ここに画像の説明を入力してください

答え2

\pscharclipパッケージに付属するものを活用できますpst-text:

\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{pstricks,psvectorian,pst-text}
\usepackage{scalerel} % For Vertical Stretch of Letters
\usepackage{graphicx}
\usepackage{color}

% Overlay Title
\newcommand{\mytitle}[1]{% #1 = title
    \parbox{\columnwidth}{\centering\Huge\textbf{#1}}%
}

\newcommand{\mytitleA}[1]% #1 = title
{\bgroup
  \Huge\textbf{#1}%
\egroup}

\begin{document}
\thispagestyle{empty}

\begin{pspicture}(-5.09,-5.09)(5.09,12.09)%
\renewcommand*{\psvectorianDefaultColor}{yellow!65!red}%
\psframe[fillcolor=yellow!65!red,fillstyle=solid](-5,-5)(5,12) 
\psframe[linecolor=black,linewidth=4pt](-5.09,-5.09)(5.09,12.09)% 

% TITLE 
\newdimen{\shiftedY}
\pssetlength{\shiftedY}{5cm}
\psaddtolength{\shiftedY}{-1.45pt}

\rput(0,\shiftedY){\vstretch{1.25}{\mytitle{CUT-OUT TITLE \\ AND PLACE \\ OVER IMAGE}}}

\pscharclip[linewidth=0pt,linestyle=none]{
    \rput(0,5){\vstretch{1.25}{\mytitle{CUT-OUT TITLE \\ AND PLACE \\ OVER IMAGE}}}
}
    \rput(0,3.5){\includegraphics[width=.87\linewidth,height=1.49\linewidth]{example-image-a}}
\endpscharclip

\end{pspicture}%
\end{document}

ここに画像の説明を入力してください


使用この素晴らしい提案出発点として、Tiを使用して次の操作を実行できます。Z. できるだけあなたの例に忠実に再現しようとしましたが、特にフォント サイズに関してはまだ異なっているようです。とにかく、主なアイデアが明確であることを願っています。これをコンパイルするには、PDFLaTeX または LuaLaTeX を使用する必要があります。

\documentclass[a5paper,12pt,onecolumn,openany,final]{book}\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}

\usepackage{tikz}
\usetikzlibrary{fadings}

\newcommand{\mytitle}[2]{%
    \begin{tikzfadingfrompicture}[name=mytitle, color=transparent!0]
    
        % create fading from title
        \node[text width=\linewidth, align=center, font=\bfseries\Huge, yscale=1.25, transform shape] at (current page.center) {#2};
        
    \end{tikzfadingfrompicture}%
    \begin{tikzpicture}[overlay, remember picture]
    
        % orange background
        \fill[yellow!65!red, draw=black, line width=8pt] (current page.south west) rectangle (current page.north east);
    
        % text title shadow
        \fill[path fading=mytitle, fit fading=false, fading transform={shift=(current page.center)}, transform canvas={xshift=1pt, yshift=-1pt}] (current page.south west) rectangle (current page.north east);
        
        % text title cut out
        \fill[path fading=mytitle, fit fading=false, fading transform={shift=(current page.center)}, path picture={\node at (path picture bounding box.center) {
            \includegraphics[height=\paperheight, width=\paperwidth, keepaspectratio]{#1}
        };}] (current page.south west) rectangle (current page.north east);

    \end{tikzpicture}%
}

\begin{document}
\thispagestyle{empty}

\mytitle{background}{CUT-OUT TITLE \\ AND PLACE \\ OVER IMAGE}

\end{document}

ここに画像の説明を入力してください

関連情報