I have an image of a iPhone X and I want to add a screenshot inside the phone. How can I crop the image or mask it so it fits the entire screen including under the iPhone x top status bar
Personally I would prefer to draw the iPhone interface as a vector from scratch, as it would give me a lot of control over the finished output. But that path would require more knowledge of Inkscape and/or time investment than you may have available or be willing to use.
The easiest way is to import both images into a document then select the iPhone screen
Path -> Trace Bitmap
as your image is mostly black and white it will be pretty straightforward. This will turn the raster image (non editable) into a vector image (editable)
duplicate the vectorised iPhone image
Edit -> Duplicate
Path -> Break Apart, Object -> Ungroup
This should give you a several paths. You only need the one matching the inner line of the iPhone screen, delete the other paths created.
Position the screen path over the image you intend to use as a screen, make sure both are selected, don't worry about the fill colour, and use
Object -> Align and Distribute
to centre both vertically and horizontally. If the Screen background is smaller than the screen border path select the background and drag on one of the corners whilst holding down CONTROL SHIFT to scale in place. Then, making sure the screen outline path is topmost
Object -> Clip -> Set
This will create a clipping mask matching the shape of the iPhone screen.
Go back to the vector trace you made earlier
Switch to the Node Selection tool (F2) and click on the white screen area, set the fill to transparent (the colour icon on the palette bar that looks like a white square with a red cross through it). Then use
Object -> Align and Distribute
to centre the screen on the other iPhone background vector.
Now you may need to alter the z order of the objects so switch back to the Select and Transform tool (F1) and either raise the iPhone vector or drop the screen clipping group
Object -> Raise to Top, Object -> Lower to Bottom
you can adjust the clipping mask to accommodate the lower border of the screen graphic by switching to the Node Selection Tool (f2) then shift selecting the all the nodes at the bottom of the 'screen' and moving them up - use the arrow keys for more precise nudges or hold down CONTROL when you click and drag to constrain movement to vertical or horizontal only.
Or simply draw a white rectangle to mask over the image as much as you like and lower it below the iPhone vector. Select everything and
Object -> Group
for easier handling after
If you do not want to trace the image, but want to use the imported bitmap image, or a photo, and clip it to the correct size, do:
- Select the frame of the iPhone vector image. Separate the shape of the screen out of it, either by ungrouping or by using Path > Break apart (or draw it, if it doesn't appear to be possible). You may want to duplicate the frame object first.
- Move the photo below the separated screen shape and adjust its position.
- Select both the photo and the screen shape
- do Object > Clip... > Set