Overlay image with parts of another imageDrawing on an image with TikZOverlay symbol with anotherTikz: overlay png or pdf image over another pdf figureNumerical conditional within tikz keys?Help understanding the coordinate system used in tikzHow to get rid of white space when drawing lines in TikZ with documentclass=standalone?One image per overlay?Line up nested tikz enviroments or how to get rid of themShareLatex - Image Placement Question - APATikz image within a defined box (& the textpos package)
Which was the first story to feature force fields?
What is the narrative difference between a Charisma and Wisdom saving throw?
Is the weight of the aircraft flying in the sky transferred to the ground?
How to think about speed or velocity of an electron (in an atom)?
How do I find the absolute maximum and absolute minimum of a function on the given interval?
Finding New York City tournaments as a visitor from Moscow
Is the endomorphism ring of a module over a non-commutative ring always non-commutative?
Narrowing a dataset down by string pattern
being overqualified as a barrier for getting a job
Partial Relaxation
Table columns widths are not equal
Marijuana use and job/grant opportunities
Why is there no No:6 in the movie?
Check if simple regex matches string
Finishing pre-cooked prime rib, day-of?
Set identification
Yet, another part ID question: Large blue dish
Could a robot that can survive at the center of the Earth also survive a nuclear explosion?
Has any person or company ever become a sovereign state?
How can I get 2 characters to bond while standing alternate watches?
How to permanently set refresh interval for top command?
Is there a word/short phrase for "the most" of something (not necessarily the majority)?
How can I force a bank to close my account with them?
Planet where giant manned machines travel in convoy across surface, tracking some astronomical phenomenon
Overlay image with parts of another image
Drawing on an image with TikZOverlay symbol with anotherTikz: overlay png or pdf image over another pdf figureNumerical conditional within tikz keys?Help understanding the coordinate system used in tikzHow to get rid of white space when drawing lines in TikZ with documentclass=standalone?One image per overlay?Line up nested tikz enviroments or how to get rid of themShareLatex - Image Placement Question - APATikz image within a defined box (& the textpos package)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I have the following image
Is there some way for me in Tikz, to remove the part to the right of the white line, and insert it with a slide of another image? Ideally I should be able to select 0-1 how far the image is to the right.
For instance with the following image,
the result could look like this
Sorry for no MWE, as I am very unsure where to start. Any help getting started would be much appreciated.
EDIT:
Thanks to Ignasis I was able to produce an MWE. The result looks like this
Improvements / Things I was not able to fix myself
I was not able to include my original
8pyV9.jpg
as this kept
throwing me anPackage graphics Error: Division by 0.?
. Why? I tried to change the filename, alas nothing helped.Why is there a white margin on the bottom and to the right of the images? I would like them to be flush with the page borders.
Is there a way to make sure the blue image fits the pagewidth, where the white line is correctly placed? I was able to set it correctly manually now, but if I change the page borders, it throws everything off.
Is it possible to move the right image right and left to choose which parts is included?
MWE
documentclassarticle
usepackagetikz
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
usepackagegraphics,graphicx,calc
definecolormainHTML003349
begindocument
pagestyleempty
newgeometrymargin=0pt
defmygraphicincludegraphics[width=textwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
vspace*fillnoindent%
begintikzpicture
%
beginscope
path[clip] (18,0)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east] at (18,0) includegraphics[height=graphicheight]uniwallpaper.jpeg;
% fill[color=main,opacity=0.8] (0,0) rectangle (textwidth,graphicheight);
endscope
beginscope
path[clip] (0,0)--++(0:11.2cm)--++(70:graphicheight)-|cycle;
node[anchor=south west] includegraphics[width=textwidth]Q7xB7.png;
endscope
endtikzpicture
enddocument
tikz-pgf graphics overlays
add a comment
|
I have the following image
Is there some way for me in Tikz, to remove the part to the right of the white line, and insert it with a slide of another image? Ideally I should be able to select 0-1 how far the image is to the right.
For instance with the following image,
the result could look like this
Sorry for no MWE, as I am very unsure where to start. Any help getting started would be much appreciated.
EDIT:
Thanks to Ignasis I was able to produce an MWE. The result looks like this
Improvements / Things I was not able to fix myself
I was not able to include my original
8pyV9.jpg
as this kept
throwing me anPackage graphics Error: Division by 0.?
. Why? I tried to change the filename, alas nothing helped.Why is there a white margin on the bottom and to the right of the images? I would like them to be flush with the page borders.
Is there a way to make sure the blue image fits the pagewidth, where the white line is correctly placed? I was able to set it correctly manually now, but if I change the page borders, it throws everything off.
Is it possible to move the right image right and left to choose which parts is included?
MWE
documentclassarticle
usepackagetikz
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
usepackagegraphics,graphicx,calc
definecolormainHTML003349
begindocument
pagestyleempty
newgeometrymargin=0pt
defmygraphicincludegraphics[width=textwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
vspace*fillnoindent%
begintikzpicture
%
beginscope
path[clip] (18,0)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east] at (18,0) includegraphics[height=graphicheight]uniwallpaper.jpeg;
% fill[color=main,opacity=0.8] (0,0) rectangle (textwidth,graphicheight);
endscope
beginscope
path[clip] (0,0)--++(0:11.2cm)--++(70:graphicheight)-|cycle;
node[anchor=south west] includegraphics[width=textwidth]Q7xB7.png;
endscope
endtikzpicture
enddocument
tikz-pgf graphics overlays
3
Where is the problem? Simply set a clipping path and then insert the second picture.
– Ulrike Fischer
Oct 1 at 9:53
add a comment
|
I have the following image
Is there some way for me in Tikz, to remove the part to the right of the white line, and insert it with a slide of another image? Ideally I should be able to select 0-1 how far the image is to the right.
For instance with the following image,
the result could look like this
Sorry for no MWE, as I am very unsure where to start. Any help getting started would be much appreciated.
EDIT:
Thanks to Ignasis I was able to produce an MWE. The result looks like this
Improvements / Things I was not able to fix myself
I was not able to include my original
8pyV9.jpg
as this kept
throwing me anPackage graphics Error: Division by 0.?
. Why? I tried to change the filename, alas nothing helped.Why is there a white margin on the bottom and to the right of the images? I would like them to be flush with the page borders.
Is there a way to make sure the blue image fits the pagewidth, where the white line is correctly placed? I was able to set it correctly manually now, but if I change the page borders, it throws everything off.
Is it possible to move the right image right and left to choose which parts is included?
MWE
documentclassarticle
usepackagetikz
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
usepackagegraphics,graphicx,calc
definecolormainHTML003349
begindocument
pagestyleempty
newgeometrymargin=0pt
defmygraphicincludegraphics[width=textwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
vspace*fillnoindent%
begintikzpicture
%
beginscope
path[clip] (18,0)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east] at (18,0) includegraphics[height=graphicheight]uniwallpaper.jpeg;
% fill[color=main,opacity=0.8] (0,0) rectangle (textwidth,graphicheight);
endscope
beginscope
path[clip] (0,0)--++(0:11.2cm)--++(70:graphicheight)-|cycle;
node[anchor=south west] includegraphics[width=textwidth]Q7xB7.png;
endscope
endtikzpicture
enddocument
tikz-pgf graphics overlays
I have the following image
Is there some way for me in Tikz, to remove the part to the right of the white line, and insert it with a slide of another image? Ideally I should be able to select 0-1 how far the image is to the right.
For instance with the following image,
the result could look like this
Sorry for no MWE, as I am very unsure where to start. Any help getting started would be much appreciated.
EDIT:
Thanks to Ignasis I was able to produce an MWE. The result looks like this
Improvements / Things I was not able to fix myself
I was not able to include my original
8pyV9.jpg
as this kept
throwing me anPackage graphics Error: Division by 0.?
. Why? I tried to change the filename, alas nothing helped.Why is there a white margin on the bottom and to the right of the images? I would like them to be flush with the page borders.
Is there a way to make sure the blue image fits the pagewidth, where the white line is correctly placed? I was able to set it correctly manually now, but if I change the page borders, it throws everything off.
Is it possible to move the right image right and left to choose which parts is included?
MWE
documentclassarticle
usepackagetikz
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
usepackagegraphics,graphicx,calc
definecolormainHTML003349
begindocument
pagestyleempty
newgeometrymargin=0pt
defmygraphicincludegraphics[width=textwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
vspace*fillnoindent%
begintikzpicture
%
beginscope
path[clip] (18,0)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east] at (18,0) includegraphics[height=graphicheight]uniwallpaper.jpeg;
% fill[color=main,opacity=0.8] (0,0) rectangle (textwidth,graphicheight);
endscope
beginscope
path[clip] (0,0)--++(0:11.2cm)--++(70:graphicheight)-|cycle;
node[anchor=south west] includegraphics[width=textwidth]Q7xB7.png;
endscope
endtikzpicture
enddocument
tikz-pgf graphics overlays
tikz-pgf graphics overlays
edited Oct 1 at 13:16
N3buchadnezzar
asked Oct 1 at 9:19
N3buchadnezzarN3buchadnezzar
9,9706 gold badges45 silver badges100 bronze badges
9,9706 gold badges45 silver badges100 bronze badges
3
Where is the problem? Simply set a clipping path and then insert the second picture.
– Ulrike Fischer
Oct 1 at 9:53
add a comment
|
3
Where is the problem? Simply set a clipping path and then insert the second picture.
– Ulrike Fischer
Oct 1 at 9:53
3
3
Where is the problem? Simply set a clipping path and then insert the second picture.
– Ulrike Fischer
Oct 1 at 9:53
Where is the problem? Simply set a clipping path and then insert the second picture.
– Ulrike Fischer
Oct 1 at 9:53
add a comment
|
3 Answers
3
active
oldest
votes
This is very similar to the other two answers with the main difference being that I install a local coordinate system on the pic to make things more convenient. You still need to find out the coordinates by looking, but now the clip path becomes
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
where the coordinates are such that (0,0)
is the lower left and (1,1)
the upper right corner of the "reference" picture. This way you do not have to put in explicit dimensions.
documentclassarticle
usepackagetikz
usetikzlibrarycalc
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
begindocument
begintikzpicture[nodes=inner sep=0pt,anchor=south west]
node (X) includegraphics[width=textwidth]picA;
beginscope[x=(X.south east),y=(X.north west)]
beginscope
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
path let p1=(X.north east) in (0,0)
nodeincludegraphics[width=x1,height=y1]picB;
endscope
endscope
endtikzpicture
enddocument
@Schödinger's cat This seems very close! Is there a way to move the triangle image more to the right?
– N3buchadnezzar
Oct 1 at 17:26
@N3buchadnezzar The position of the triangle is specified inclip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
, which says that the lower left point is at 63.45% of the width and the upper point at 96.3% of the width. If you increase these x coordinates, the triangle will move right. (I adjusted these values to match the white line in your image.)
– Schrödinger's cat
Oct 1 at 17:30
English is hard! The placement of the white line is perfect. I wonder if it is possible to move the underlying image like so i.stack.imgur.com/PSTfh.png
– N3buchadnezzar
Oct 1 at 17:38
@N3buchadnezzar Sure. Just replacepath let p1=(X.north east) in (0,0) nodeincludegraphics[width=x1,height=y1]picB;
bypath let p1=(X.north east) in (0.1,0) nodeincludegraphics[width=x1,height=y1]picB;
, i.e. increase the x position of the second picture. (I am on a different machine now, so I can't tell if0.1
is a good choice, but you need to increase the x value of the coordinate.)
– Schrödinger's cat
Oct 1 at 17:47
Yes, yes. I was able to figure this out right after asking. I can adjust the values myself. I am creating a package where the user is given the options to add images and move them. My images are just for examples =)
– N3buchadnezzar
Oct 1 at 18:00
add a comment
|
To expand on Ulrike's comment, here is a quick and dirty example on how to clip an external image that is directly taken from the pgf manual
documentclass[12pt,a4paper]article
usepackagegraphicx,tikz
begindocument
begintikzpicture[path image/.style=
path picture=
node at (path picture bounding box.center)
includegraphics[height=3cm]#1
;]
draw [path image=example-image-b,thick](0,1) -- (0,3) -- (1.5, 1.5) -- (1,1) -- cycle;
endtikzpicture
enddocument
Then you can superimpose two images, once having clipped one.
add a comment
|
Another solution clipping images included as nodes:
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
beginscope
path[clip] (0,0)--++(0:3.5cm)--++(75:3cm)-|cycle;
node[anchor=south west] includegraphics[width=6cm]Q7xB7;
endscope
beginscope
path[clip] (6,0)--++(180:2.3cm)--++(75:3cm)-|cycle;
node[anchor=south east] at (6,0) includegraphics[height=3cm]8pyV9;
endscope
endtikzpicture
enddocument
Update
If you want to cover some part of the page with this picture, it's better to use absolut positioning, which can be done with remember picture
and overlay
options and using the current page
node. You need to compile twice before getting the correct result.
The white space around the figure was due to inner sep
which keeps a certain distance between node contents and border. With inner sep=0pt
, there is no space.
Finally you can use bb
("bounding box") option from graphicx
package to select which part of the included figure is shown: bb=0 0 1400 702
means take the rectangle from (0,0) to (1400,702) points (Postscript points not pixels). I think you'll have to test to find the desired fragment.
documentclassarticle
usepackagetikz
usepackage[b5paper, lmargin=25mm, rmargin=25mm, tmargin=27mm, bmargin=30mm]geometry
%usepackagegraphics,graphicx,calc
usepackagecalc
definecolormainHTML003349
pagestyleempty
defmygraphicincludegraphics[width=paperwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
begindocument
begintikzpicture[overlay, remember picture]
%
beginscope
path[clip] (current page.south west)--++(0:10.8cm)--++(70:graphicheight)-|cycle;
node[anchor=south west, inner sep=0pt] at (current page.south west) mygraphic;
endscope%
beginscope
path[clip] (current page.south east)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east, inner sep=0pt] at (current page.south east) includegraphics[height=graphicheight, bb=0 0 1400 702, clip]8pyV9;
endscope
endtikzpicture
enddocument
This seems close, but it still seems I have to manually set the dimensions. What I really want is the deep blue to fill the bottom of the page, and then stretch or shrink the other half to fit the space. Here is what I have so far i.imgur.com/3OqC3HJ.png. I can add an MWE in the first post or create a new question.
– N3buchadnezzar
Oct 1 at 12:06
@N3buchadnezzar Please, take a look at updated answer. I hope it's better now.
– Ignasi
Oct 1 at 14:08
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f510505%2foverlay-image-with-parts-of-another-image%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is very similar to the other two answers with the main difference being that I install a local coordinate system on the pic to make things more convenient. You still need to find out the coordinates by looking, but now the clip path becomes
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
where the coordinates are such that (0,0)
is the lower left and (1,1)
the upper right corner of the "reference" picture. This way you do not have to put in explicit dimensions.
documentclassarticle
usepackagetikz
usetikzlibrarycalc
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
begindocument
begintikzpicture[nodes=inner sep=0pt,anchor=south west]
node (X) includegraphics[width=textwidth]picA;
beginscope[x=(X.south east),y=(X.north west)]
beginscope
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
path let p1=(X.north east) in (0,0)
nodeincludegraphics[width=x1,height=y1]picB;
endscope
endscope
endtikzpicture
enddocument
@Schödinger's cat This seems very close! Is there a way to move the triangle image more to the right?
– N3buchadnezzar
Oct 1 at 17:26
@N3buchadnezzar The position of the triangle is specified inclip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
, which says that the lower left point is at 63.45% of the width and the upper point at 96.3% of the width. If you increase these x coordinates, the triangle will move right. (I adjusted these values to match the white line in your image.)
– Schrödinger's cat
Oct 1 at 17:30
English is hard! The placement of the white line is perfect. I wonder if it is possible to move the underlying image like so i.stack.imgur.com/PSTfh.png
– N3buchadnezzar
Oct 1 at 17:38
@N3buchadnezzar Sure. Just replacepath let p1=(X.north east) in (0,0) nodeincludegraphics[width=x1,height=y1]picB;
bypath let p1=(X.north east) in (0.1,0) nodeincludegraphics[width=x1,height=y1]picB;
, i.e. increase the x position of the second picture. (I am on a different machine now, so I can't tell if0.1
is a good choice, but you need to increase the x value of the coordinate.)
– Schrödinger's cat
Oct 1 at 17:47
Yes, yes. I was able to figure this out right after asking. I can adjust the values myself. I am creating a package where the user is given the options to add images and move them. My images are just for examples =)
– N3buchadnezzar
Oct 1 at 18:00
add a comment
|
This is very similar to the other two answers with the main difference being that I install a local coordinate system on the pic to make things more convenient. You still need to find out the coordinates by looking, but now the clip path becomes
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
where the coordinates are such that (0,0)
is the lower left and (1,1)
the upper right corner of the "reference" picture. This way you do not have to put in explicit dimensions.
documentclassarticle
usepackagetikz
usetikzlibrarycalc
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
begindocument
begintikzpicture[nodes=inner sep=0pt,anchor=south west]
node (X) includegraphics[width=textwidth]picA;
beginscope[x=(X.south east),y=(X.north west)]
beginscope
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
path let p1=(X.north east) in (0,0)
nodeincludegraphics[width=x1,height=y1]picB;
endscope
endscope
endtikzpicture
enddocument
@Schödinger's cat This seems very close! Is there a way to move the triangle image more to the right?
– N3buchadnezzar
Oct 1 at 17:26
@N3buchadnezzar The position of the triangle is specified inclip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
, which says that the lower left point is at 63.45% of the width and the upper point at 96.3% of the width. If you increase these x coordinates, the triangle will move right. (I adjusted these values to match the white line in your image.)
– Schrödinger's cat
Oct 1 at 17:30
English is hard! The placement of the white line is perfect. I wonder if it is possible to move the underlying image like so i.stack.imgur.com/PSTfh.png
– N3buchadnezzar
Oct 1 at 17:38
@N3buchadnezzar Sure. Just replacepath let p1=(X.north east) in (0,0) nodeincludegraphics[width=x1,height=y1]picB;
bypath let p1=(X.north east) in (0.1,0) nodeincludegraphics[width=x1,height=y1]picB;
, i.e. increase the x position of the second picture. (I am on a different machine now, so I can't tell if0.1
is a good choice, but you need to increase the x value of the coordinate.)
– Schrödinger's cat
Oct 1 at 17:47
Yes, yes. I was able to figure this out right after asking. I can adjust the values myself. I am creating a package where the user is given the options to add images and move them. My images are just for examples =)
– N3buchadnezzar
Oct 1 at 18:00
add a comment
|
This is very similar to the other two answers with the main difference being that I install a local coordinate system on the pic to make things more convenient. You still need to find out the coordinates by looking, but now the clip path becomes
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
where the coordinates are such that (0,0)
is the lower left and (1,1)
the upper right corner of the "reference" picture. This way you do not have to put in explicit dimensions.
documentclassarticle
usepackagetikz
usetikzlibrarycalc
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
begindocument
begintikzpicture[nodes=inner sep=0pt,anchor=south west]
node (X) includegraphics[width=textwidth]picA;
beginscope[x=(X.south east),y=(X.north west)]
beginscope
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
path let p1=(X.north east) in (0,0)
nodeincludegraphics[width=x1,height=y1]picB;
endscope
endscope
endtikzpicture
enddocument
This is very similar to the other two answers with the main difference being that I install a local coordinate system on the pic to make things more convenient. You still need to find out the coordinates by looking, but now the clip path becomes
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
where the coordinates are such that (0,0)
is the lower left and (1,1)
the upper right corner of the "reference" picture. This way you do not have to put in explicit dimensions.
documentclassarticle
usepackagetikz
usetikzlibrarycalc
usepackage[b5paper,lmargin=25mm, rmargin=25mm,tmargin=27mm, bmargin=30mm]geometry
begindocument
begintikzpicture[nodes=inner sep=0pt,anchor=south west]
node (X) includegraphics[width=textwidth]picA;
beginscope[x=(X.south east),y=(X.north west)]
beginscope
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
path let p1=(X.north east) in (0,0)
nodeincludegraphics[width=x1,height=y1]picB;
endscope
endscope
endtikzpicture
enddocument
answered Oct 1 at 13:49
Schrödinger's catSchrödinger's cat
31.6k2 gold badges45 silver badges72 bronze badges
31.6k2 gold badges45 silver badges72 bronze badges
@Schödinger's cat This seems very close! Is there a way to move the triangle image more to the right?
– N3buchadnezzar
Oct 1 at 17:26
@N3buchadnezzar The position of the triangle is specified inclip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
, which says that the lower left point is at 63.45% of the width and the upper point at 96.3% of the width. If you increase these x coordinates, the triangle will move right. (I adjusted these values to match the white line in your image.)
– Schrödinger's cat
Oct 1 at 17:30
English is hard! The placement of the white line is perfect. I wonder if it is possible to move the underlying image like so i.stack.imgur.com/PSTfh.png
– N3buchadnezzar
Oct 1 at 17:38
@N3buchadnezzar Sure. Just replacepath let p1=(X.north east) in (0,0) nodeincludegraphics[width=x1,height=y1]picB;
bypath let p1=(X.north east) in (0.1,0) nodeincludegraphics[width=x1,height=y1]picB;
, i.e. increase the x position of the second picture. (I am on a different machine now, so I can't tell if0.1
is a good choice, but you need to increase the x value of the coordinate.)
– Schrödinger's cat
Oct 1 at 17:47
Yes, yes. I was able to figure this out right after asking. I can adjust the values myself. I am creating a package where the user is given the options to add images and move them. My images are just for examples =)
– N3buchadnezzar
Oct 1 at 18:00
add a comment
|
@Schödinger's cat This seems very close! Is there a way to move the triangle image more to the right?
– N3buchadnezzar
Oct 1 at 17:26
@N3buchadnezzar The position of the triangle is specified inclip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
, which says that the lower left point is at 63.45% of the width and the upper point at 96.3% of the width. If you increase these x coordinates, the triangle will move right. (I adjusted these values to match the white line in your image.)
– Schrödinger's cat
Oct 1 at 17:30
English is hard! The placement of the white line is perfect. I wonder if it is possible to move the underlying image like so i.stack.imgur.com/PSTfh.png
– N3buchadnezzar
Oct 1 at 17:38
@N3buchadnezzar Sure. Just replacepath let p1=(X.north east) in (0,0) nodeincludegraphics[width=x1,height=y1]picB;
bypath let p1=(X.north east) in (0.1,0) nodeincludegraphics[width=x1,height=y1]picB;
, i.e. increase the x position of the second picture. (I am on a different machine now, so I can't tell if0.1
is a good choice, but you need to increase the x value of the coordinate.)
– Schrödinger's cat
Oct 1 at 17:47
Yes, yes. I was able to figure this out right after asking. I can adjust the values myself. I am creating a package where the user is given the options to add images and move them. My images are just for examples =)
– N3buchadnezzar
Oct 1 at 18:00
@Schödinger's cat This seems very close! Is there a way to move the triangle image more to the right?
– N3buchadnezzar
Oct 1 at 17:26
@Schödinger's cat This seems very close! Is there a way to move the triangle image more to the right?
– N3buchadnezzar
Oct 1 at 17:26
@N3buchadnezzar The position of the triangle is specified in
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
, which says that the lower left point is at 63.45% of the width and the upper point at 96.3% of the width. If you increase these x coordinates, the triangle will move right. (I adjusted these values to match the white line in your image.)– Schrödinger's cat
Oct 1 at 17:30
@N3buchadnezzar The position of the triangle is specified in
clip (0.6345,0) -- (0.963,1) -| (1,0) -- cycle;
, which says that the lower left point is at 63.45% of the width and the upper point at 96.3% of the width. If you increase these x coordinates, the triangle will move right. (I adjusted these values to match the white line in your image.)– Schrödinger's cat
Oct 1 at 17:30
English is hard! The placement of the white line is perfect. I wonder if it is possible to move the underlying image like so i.stack.imgur.com/PSTfh.png
– N3buchadnezzar
Oct 1 at 17:38
English is hard! The placement of the white line is perfect. I wonder if it is possible to move the underlying image like so i.stack.imgur.com/PSTfh.png
– N3buchadnezzar
Oct 1 at 17:38
@N3buchadnezzar Sure. Just replace
path let p1=(X.north east) in (0,0) nodeincludegraphics[width=x1,height=y1]picB;
by path let p1=(X.north east) in (0.1,0) nodeincludegraphics[width=x1,height=y1]picB;
, i.e. increase the x position of the second picture. (I am on a different machine now, so I can't tell if 0.1
is a good choice, but you need to increase the x value of the coordinate.)– Schrödinger's cat
Oct 1 at 17:47
@N3buchadnezzar Sure. Just replace
path let p1=(X.north east) in (0,0) nodeincludegraphics[width=x1,height=y1]picB;
by path let p1=(X.north east) in (0.1,0) nodeincludegraphics[width=x1,height=y1]picB;
, i.e. increase the x position of the second picture. (I am on a different machine now, so I can't tell if 0.1
is a good choice, but you need to increase the x value of the coordinate.)– Schrödinger's cat
Oct 1 at 17:47
Yes, yes. I was able to figure this out right after asking. I can adjust the values myself. I am creating a package where the user is given the options to add images and move them. My images are just for examples =)
– N3buchadnezzar
Oct 1 at 18:00
Yes, yes. I was able to figure this out right after asking. I can adjust the values myself. I am creating a package where the user is given the options to add images and move them. My images are just for examples =)
– N3buchadnezzar
Oct 1 at 18:00
add a comment
|
To expand on Ulrike's comment, here is a quick and dirty example on how to clip an external image that is directly taken from the pgf manual
documentclass[12pt,a4paper]article
usepackagegraphicx,tikz
begindocument
begintikzpicture[path image/.style=
path picture=
node at (path picture bounding box.center)
includegraphics[height=3cm]#1
;]
draw [path image=example-image-b,thick](0,1) -- (0,3) -- (1.5, 1.5) -- (1,1) -- cycle;
endtikzpicture
enddocument
Then you can superimpose two images, once having clipped one.
add a comment
|
To expand on Ulrike's comment, here is a quick and dirty example on how to clip an external image that is directly taken from the pgf manual
documentclass[12pt,a4paper]article
usepackagegraphicx,tikz
begindocument
begintikzpicture[path image/.style=
path picture=
node at (path picture bounding box.center)
includegraphics[height=3cm]#1
;]
draw [path image=example-image-b,thick](0,1) -- (0,3) -- (1.5, 1.5) -- (1,1) -- cycle;
endtikzpicture
enddocument
Then you can superimpose two images, once having clipped one.
add a comment
|
To expand on Ulrike's comment, here is a quick and dirty example on how to clip an external image that is directly taken from the pgf manual
documentclass[12pt,a4paper]article
usepackagegraphicx,tikz
begindocument
begintikzpicture[path image/.style=
path picture=
node at (path picture bounding box.center)
includegraphics[height=3cm]#1
;]
draw [path image=example-image-b,thick](0,1) -- (0,3) -- (1.5, 1.5) -- (1,1) -- cycle;
endtikzpicture
enddocument
Then you can superimpose two images, once having clipped one.
To expand on Ulrike's comment, here is a quick and dirty example on how to clip an external image that is directly taken from the pgf manual
documentclass[12pt,a4paper]article
usepackagegraphicx,tikz
begindocument
begintikzpicture[path image/.style=
path picture=
node at (path picture bounding box.center)
includegraphics[height=3cm]#1
;]
draw [path image=example-image-b,thick](0,1) -- (0,3) -- (1.5, 1.5) -- (1,1) -- cycle;
endtikzpicture
enddocument
Then you can superimpose two images, once having clipped one.
answered Oct 1 at 10:16
DenisDenis
3,4316 silver badges26 bronze badges
3,4316 silver badges26 bronze badges
add a comment
|
add a comment
|
Another solution clipping images included as nodes:
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
beginscope
path[clip] (0,0)--++(0:3.5cm)--++(75:3cm)-|cycle;
node[anchor=south west] includegraphics[width=6cm]Q7xB7;
endscope
beginscope
path[clip] (6,0)--++(180:2.3cm)--++(75:3cm)-|cycle;
node[anchor=south east] at (6,0) includegraphics[height=3cm]8pyV9;
endscope
endtikzpicture
enddocument
Update
If you want to cover some part of the page with this picture, it's better to use absolut positioning, which can be done with remember picture
and overlay
options and using the current page
node. You need to compile twice before getting the correct result.
The white space around the figure was due to inner sep
which keeps a certain distance between node contents and border. With inner sep=0pt
, there is no space.
Finally you can use bb
("bounding box") option from graphicx
package to select which part of the included figure is shown: bb=0 0 1400 702
means take the rectangle from (0,0) to (1400,702) points (Postscript points not pixels). I think you'll have to test to find the desired fragment.
documentclassarticle
usepackagetikz
usepackage[b5paper, lmargin=25mm, rmargin=25mm, tmargin=27mm, bmargin=30mm]geometry
%usepackagegraphics,graphicx,calc
usepackagecalc
definecolormainHTML003349
pagestyleempty
defmygraphicincludegraphics[width=paperwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
begindocument
begintikzpicture[overlay, remember picture]
%
beginscope
path[clip] (current page.south west)--++(0:10.8cm)--++(70:graphicheight)-|cycle;
node[anchor=south west, inner sep=0pt] at (current page.south west) mygraphic;
endscope%
beginscope
path[clip] (current page.south east)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east, inner sep=0pt] at (current page.south east) includegraphics[height=graphicheight, bb=0 0 1400 702, clip]8pyV9;
endscope
endtikzpicture
enddocument
This seems close, but it still seems I have to manually set the dimensions. What I really want is the deep blue to fill the bottom of the page, and then stretch or shrink the other half to fit the space. Here is what I have so far i.imgur.com/3OqC3HJ.png. I can add an MWE in the first post or create a new question.
– N3buchadnezzar
Oct 1 at 12:06
@N3buchadnezzar Please, take a look at updated answer. I hope it's better now.
– Ignasi
Oct 1 at 14:08
add a comment
|
Another solution clipping images included as nodes:
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
beginscope
path[clip] (0,0)--++(0:3.5cm)--++(75:3cm)-|cycle;
node[anchor=south west] includegraphics[width=6cm]Q7xB7;
endscope
beginscope
path[clip] (6,0)--++(180:2.3cm)--++(75:3cm)-|cycle;
node[anchor=south east] at (6,0) includegraphics[height=3cm]8pyV9;
endscope
endtikzpicture
enddocument
Update
If you want to cover some part of the page with this picture, it's better to use absolut positioning, which can be done with remember picture
and overlay
options and using the current page
node. You need to compile twice before getting the correct result.
The white space around the figure was due to inner sep
which keeps a certain distance between node contents and border. With inner sep=0pt
, there is no space.
Finally you can use bb
("bounding box") option from graphicx
package to select which part of the included figure is shown: bb=0 0 1400 702
means take the rectangle from (0,0) to (1400,702) points (Postscript points not pixels). I think you'll have to test to find the desired fragment.
documentclassarticle
usepackagetikz
usepackage[b5paper, lmargin=25mm, rmargin=25mm, tmargin=27mm, bmargin=30mm]geometry
%usepackagegraphics,graphicx,calc
usepackagecalc
definecolormainHTML003349
pagestyleempty
defmygraphicincludegraphics[width=paperwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
begindocument
begintikzpicture[overlay, remember picture]
%
beginscope
path[clip] (current page.south west)--++(0:10.8cm)--++(70:graphicheight)-|cycle;
node[anchor=south west, inner sep=0pt] at (current page.south west) mygraphic;
endscope%
beginscope
path[clip] (current page.south east)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east, inner sep=0pt] at (current page.south east) includegraphics[height=graphicheight, bb=0 0 1400 702, clip]8pyV9;
endscope
endtikzpicture
enddocument
This seems close, but it still seems I have to manually set the dimensions. What I really want is the deep blue to fill the bottom of the page, and then stretch or shrink the other half to fit the space. Here is what I have so far i.imgur.com/3OqC3HJ.png. I can add an MWE in the first post or create a new question.
– N3buchadnezzar
Oct 1 at 12:06
@N3buchadnezzar Please, take a look at updated answer. I hope it's better now.
– Ignasi
Oct 1 at 14:08
add a comment
|
Another solution clipping images included as nodes:
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
beginscope
path[clip] (0,0)--++(0:3.5cm)--++(75:3cm)-|cycle;
node[anchor=south west] includegraphics[width=6cm]Q7xB7;
endscope
beginscope
path[clip] (6,0)--++(180:2.3cm)--++(75:3cm)-|cycle;
node[anchor=south east] at (6,0) includegraphics[height=3cm]8pyV9;
endscope
endtikzpicture
enddocument
Update
If you want to cover some part of the page with this picture, it's better to use absolut positioning, which can be done with remember picture
and overlay
options and using the current page
node. You need to compile twice before getting the correct result.
The white space around the figure was due to inner sep
which keeps a certain distance between node contents and border. With inner sep=0pt
, there is no space.
Finally you can use bb
("bounding box") option from graphicx
package to select which part of the included figure is shown: bb=0 0 1400 702
means take the rectangle from (0,0) to (1400,702) points (Postscript points not pixels). I think you'll have to test to find the desired fragment.
documentclassarticle
usepackagetikz
usepackage[b5paper, lmargin=25mm, rmargin=25mm, tmargin=27mm, bmargin=30mm]geometry
%usepackagegraphics,graphicx,calc
usepackagecalc
definecolormainHTML003349
pagestyleempty
defmygraphicincludegraphics[width=paperwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
begindocument
begintikzpicture[overlay, remember picture]
%
beginscope
path[clip] (current page.south west)--++(0:10.8cm)--++(70:graphicheight)-|cycle;
node[anchor=south west, inner sep=0pt] at (current page.south west) mygraphic;
endscope%
beginscope
path[clip] (current page.south east)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east, inner sep=0pt] at (current page.south east) includegraphics[height=graphicheight, bb=0 0 1400 702, clip]8pyV9;
endscope
endtikzpicture
enddocument
Another solution clipping images included as nodes:
documentclass[tikz,border=2mm]standalone
begindocument
begintikzpicture
beginscope
path[clip] (0,0)--++(0:3.5cm)--++(75:3cm)-|cycle;
node[anchor=south west] includegraphics[width=6cm]Q7xB7;
endscope
beginscope
path[clip] (6,0)--++(180:2.3cm)--++(75:3cm)-|cycle;
node[anchor=south east] at (6,0) includegraphics[height=3cm]8pyV9;
endscope
endtikzpicture
enddocument
Update
If you want to cover some part of the page with this picture, it's better to use absolut positioning, which can be done with remember picture
and overlay
options and using the current page
node. You need to compile twice before getting the correct result.
The white space around the figure was due to inner sep
which keeps a certain distance between node contents and border. With inner sep=0pt
, there is no space.
Finally you can use bb
("bounding box") option from graphicx
package to select which part of the included figure is shown: bb=0 0 1400 702
means take the rectangle from (0,0) to (1400,702) points (Postscript points not pixels). I think you'll have to test to find the desired fragment.
documentclassarticle
usepackagetikz
usepackage[b5paper, lmargin=25mm, rmargin=25mm, tmargin=27mm, bmargin=30mm]geometry
%usepackagegraphics,graphicx,calc
usepackagecalc
definecolormainHTML003349
pagestyleempty
defmygraphicincludegraphics[width=paperwidth]Q7xB7.png
newlengthgraphicheight
setlengthgraphicheightheightofmygraphic
begindocument
begintikzpicture[overlay, remember picture]
%
beginscope
path[clip] (current page.south west)--++(0:10.8cm)--++(70:graphicheight)-|cycle;
node[anchor=south west, inner sep=0pt] at (current page.south west) mygraphic;
endscope%
beginscope
path[clip] (current page.south east)--++(180:6.7cm)--++(70:graphicheight)-|cycle;
node[anchor=south east, inner sep=0pt] at (current page.south east) includegraphics[height=graphicheight, bb=0 0 1400 702, clip]8pyV9;
endscope
endtikzpicture
enddocument
edited Oct 1 at 14:07
answered Oct 1 at 10:28
IgnasiIgnasi
104k7 gold badges191 silver badges352 bronze badges
104k7 gold badges191 silver badges352 bronze badges
This seems close, but it still seems I have to manually set the dimensions. What I really want is the deep blue to fill the bottom of the page, and then stretch or shrink the other half to fit the space. Here is what I have so far i.imgur.com/3OqC3HJ.png. I can add an MWE in the first post or create a new question.
– N3buchadnezzar
Oct 1 at 12:06
@N3buchadnezzar Please, take a look at updated answer. I hope it's better now.
– Ignasi
Oct 1 at 14:08
add a comment
|
This seems close, but it still seems I have to manually set the dimensions. What I really want is the deep blue to fill the bottom of the page, and then stretch or shrink the other half to fit the space. Here is what I have so far i.imgur.com/3OqC3HJ.png. I can add an MWE in the first post or create a new question.
– N3buchadnezzar
Oct 1 at 12:06
@N3buchadnezzar Please, take a look at updated answer. I hope it's better now.
– Ignasi
Oct 1 at 14:08
This seems close, but it still seems I have to manually set the dimensions. What I really want is the deep blue to fill the bottom of the page, and then stretch or shrink the other half to fit the space. Here is what I have so far i.imgur.com/3OqC3HJ.png. I can add an MWE in the first post or create a new question.
– N3buchadnezzar
Oct 1 at 12:06
This seems close, but it still seems I have to manually set the dimensions. What I really want is the deep blue to fill the bottom of the page, and then stretch or shrink the other half to fit the space. Here is what I have so far i.imgur.com/3OqC3HJ.png. I can add an MWE in the first post or create a new question.
– N3buchadnezzar
Oct 1 at 12:06
@N3buchadnezzar Please, take a look at updated answer. I hope it's better now.
– Ignasi
Oct 1 at 14:08
@N3buchadnezzar Please, take a look at updated answer. I hope it's better now.
– Ignasi
Oct 1 at 14:08
add a comment
|
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f510505%2foverlay-image-with-parts-of-another-image%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Where is the problem? Simply set a clipping path and then insert the second picture.
– Ulrike Fischer
Oct 1 at 9:53