Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture webpage with device frame #27

Closed
wants to merge 7 commits into from

Conversation

nsisodiya
Copy link

@nsisodiya nsisodiya commented May 21, 2019

Fixes #26

Narendra Sisodiya and others added 2 commits May 21, 2019 18:16
device-frames/frames-config.js Outdated Show resolved Hide resolved
device-frames/frames-config.js Outdated Show resolved Hide resolved
example.js Outdated Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
@@ -5,6 +5,8 @@ const fileUrl = require('file-url');
const puppeteer = require('puppeteer');
const devices = require('puppeteer/DeviceDescriptors');
const toughCookie = require('tough-cookie');
const sharp = require('sharp');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of depending on sharp as it's a native Node.js addon, which all kinds of problems.

Instead, why can't we just use Canvas in the renderer to combine the images?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In node.js, there is no canvas API. Are you suggesting to use this - https://www.npmjs.com/package/canvas
I can use this too. Whatever you suggest !!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting the following?

  1. Create a local html webpage and open it.
  2. The page will load an image(device frame) and the main page in an iframe.
  3. Take Screenshot using Canvas API.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, using Puppeteer. You already have a browser at your disposal.

Could maybe use https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Can you add some more frames? Especially the latest Android Pixel.

@nsisodiya
Copy link
Author

Can you add some more frames? Especially the latest Android Pixel.

I have done a "Google Image search" to get the iPhone X image. We need transparent png images with exact device frames. Also, there will be an issue with copyright too. We need images which are free to reuse too. Finding such images is difficult. You have a good reach via your Twitter. If you post that you need such device frames, people will contribute and the task will be much easier.

@sindresorhus
Copy link
Owner

@sindresorhus
Copy link
Owner

@nsisodiya Still interested in finishing this?

@nsisodiya
Copy link
Author

Hi, sorry for delayed response.
I cannot put device frames for all mobiles.
I did this for iPhone. The coding part is done, only images are left.

@annymosse
Copy link

@nsisodiya @sindresorhus , honestly waiting this feature , pupeter is a great tool but only for GUI(desktop env) not the servers, sorry i'm not too much expert to help you guys .
Note: the keywords of a devices from the url is 💀 :404 http://viewportsizes.com/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Capture webpage with device frame
3 participants