ਵੈੱਬਸਾਈਟਾਂ ਦੇ ਸੰਪੂਰਨ ਚਿੱਤਰ ਸਕਰੀਨਸ਼ਾਟ ਬਣਾਓ ਜਾਂ ਹੇਠਾਂ ਦਿੱਤੀਆਂ ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ ਦੀ ਵਰਤੋਂ ਕਰਕੇ HTML ਨੂੰ ਸਿੱਧਾ ਚਿੱਤਰਾਂ ਵਿੱਚ ਬਦਲੋ ਗਰੈਬਜ਼ਆਈਟੀ ਦਾ ਪਾਈਥਨ API. ਪਰ ਤੁਹਾਨੂੰ ਸ਼ੁਰੂ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ ਯਾਦ ਰੱਖੋ ਕਿ ਫੋਨ ਕਰਨ ਤੋਂ ਬਾਅਦ URLToImage, HTMLToImage or FileToImage theੰਗ Save or SaveTo ਸਕ੍ਰੀਨਸ਼ਾਟ ਲੈਣ ਲਈ methodੰਗ ਨੂੰ ਬੁਲਾਉਣਾ ਲਾਜ਼ਮੀ ਹੈ.
ਵੈਬ ਪੇਜ ਜਾਂ ਸਕ੍ਰੀਨਸ਼ਾਟ ਲੈਣ ਲਈ ਸਿਰਫ ਇਕ ਪੈਰਾਮੀਟਰ ਦੀ ਲੋੜ ਹੁੰਦੀ ਹੈ HTML ਨੂੰ ਤਬਦੀਲ intਓਏ ਚਿੱਤਰ ਜਿਵੇਂ ਕਿ ਹੇਠਲੀ ਉਦਾਹਰਣ ਵਿੱਚ ਦਿਖਾਇਆ ਗਿਆ ਹੈ.
grabzIt.URLToImage("https://www.tesla.com") # Then call the Save or SaveTo method
grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>") # Then call the Save or SaveTo method
grabzIt.FileToImage("example.html") # Then call the Save or SaveTo method
ਗਰੈਬਜ਼ਿਟ ਦਾ ਪਾਈਥਨ ਏਪੀਆਈ ਕਈ ਰੂਪਾਂ ਵਿੱਚ ਚਿੱਤਰ ਸਕਰੀਨਸ਼ਾਟ ਲੈ ਸਕਦਾ ਹੈ, ਜਿਸ ਵਿੱਚ ਜੇਪੀਜੀ, ਪੀਐਨਜੀ, ਵੈਬਪੀ, ਬੀਐਮਪੀ (ਐਕਸਐਨਯੂਐਮਐਕਸ, ਬਿੱਟ, ਐਕਸਯੂਐਨਐਮਐਕਸ ਬਿੱਟ, ਐਕਸਐਨਯੂਐਮਐਕਸ ਬਿੱਟ ਜਾਂ ਐਕਸਐਨਯੂਐਮਐਕਸ ਬਿੱਟ) ਅਤੇ ਟੀਆਈਐਫਐਫ ਸ਼ਾਮਲ ਹਨ. ਚਿੱਤਰ ਦੇ ਸਕਰੀਨਸ਼ਾਟ ਦਾ ਡਿਫਾਲਟ ਫਾਰਮੈਟ ਜੇਪੀਜੀ ਹੈ. ਹਾਲਾਂਕਿ ਜੇਪੀਜੀ ਪ੍ਰਤੀਬਿੰਬ ਦੀ ਗੁਣਵੱਤਾ ਕੁਝ ਕਾਰਜਾਂ ਲਈ ਇੰਨੀ ਚੰਗੀ ਨਹੀਂ ਹੋ ਸਕਦੀ ਕਿ ਇਨ੍ਹਾਂ ਸਥਿਤੀਆਂ ਵਿੱਚ ਪੀ ਐਨ ਜੀ ਫਾਰਮੈਟ ਨੂੰ ਚਿੱਤਰ ਸਕ੍ਰੀਨਸ਼ਾਟ ਲਈ ਸਿਫਾਰਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ ਕਿਉਂਕਿ ਇਹ ਗੁਣਵੱਤਾ ਅਤੇ ਫਾਈਲ ਅਕਾਰ ਦੇ ਵਿਚਕਾਰ ਇੱਕ ਚੰਗਾ ਸੰਤੁਲਨ ਦਿੰਦਾ ਹੈ. ਹੇਠਾਂ ਦਿੱਤੀ ਉਦਾਹਰਣ ਇੱਕ ਚਿੱਤਰ ਸਕਰੀਨਸ਼ਾਟ ਨੂੰ ਦਰਸਾਉਂਦੀ ਹੈ ਜੋ PNG ਫਾਰਮੈਟ ਦੀ ਵਰਤੋਂ ਨਾਲ ਲਈ ਜਾ ਰਹੀ ਹੈ.
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.format = "png" grabzIt.URLToImage("https://www.tesla.com", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.png")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.format = "png" grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.png")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.format = "png" grabzIt.FileToImage("example.html", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.png")
ਬ੍ਰਾ .ਜ਼ਰ ਦਾ ਆਕਾਰ ਬ੍ਰਾ browserਜ਼ਰ ਵਿੰਡੋ ਦੇ ਆਕਾਰ ਦਾ ਹਵਾਲਾ ਦਿੰਦਾ ਹੈ ਜਿਹੜੀ ਕਿ ਜ਼ਿਆਦਾਤਰ ਮਾਮਲਿਆਂ ਵਿੱਚ ਸਕ੍ਰੀਨਸ਼ਾਟ ਕੈਪਚਰ ਕਰਨ ਵੇਲੇ ਵਰਤੀ ਜਾਏਗੀ, ਇਸ ਨੂੰ ਸੈੱਟ ਕਰਨ ਦੀ ਜ਼ਰੂਰਤ ਨਹੀਂ ਹੈ ਕਿਉਂਕਿ ਸਾਰੇ ਬ੍ਰਾ .ਜ਼ਰ ਦੇ ਸਾਰੇ ਕੰਮਾਂ ਲਈ ਡਿਫੌਲਟ ਬਰਾ browserਜ਼ਰ ਦਾ ਅਕਾਰ ਕਾਫੀ ਹੋਵੇਗਾ. ਡਿਫੌਲਟ ਬਰਾ browserਜ਼ਰ ਸਾਈਜ਼ ਦੀ ਵਰਤੋਂ ਕਰਨ ਲਈ ਬੱਸ ਪਾਸ ਕਰੋ 0
ਨੂੰ browserWidth
ਅਤੇ browserHeight
ਦੇ ਗੁਣ GrabzItImageOptions ਕਲਾਸ.
ਕਿਸੇ ਚਿੱਤਰ ਦੇ ਆਕਾਰ ਨੂੰ ਬਦਲਣਾ ਸੌਖਾ ਹੈ, ਇਸ ਨੂੰ ਚਿੱਤਰ ਨੂੰ ਭੰਗ ਕੀਤੇ ਬਿਨਾਂ ਕਰਨਾ ਥੋੜਾ isਖਾ ਹੈ. ਸਾਰੀ ਪ੍ਰਕਿਰਿਆ ਨੂੰ ਸੌਖਾ ਬਣਾਉਣ ਲਈ ਅਸੀਂ ਤੁਹਾਨੂੰ ਇਸ ਦੀ ਵਰਤੋਂ ਕਰਨ ਦੀ ਸਿਫਾਰਸ਼ ਕਰਦੇ ਹਾਂ ਸਧਾਰਣ ਚਿੱਤਰ ਮਾਪ ਮਾਪ ਕੈਲਕੁਲੇਟਰ.
ਜੇ ਤੁਸੀਂ ਚਿੱਤਰ ਦੀ ਚੌੜਾਈ ਅਤੇ ਉਚਾਈ ਨੂੰ ਬ੍ਰਾ browserਜ਼ਰ ਦੀ ਚੌੜਾਈ ਅਤੇ ਉਚਾਈ ਤੋਂ ਵੱਡੇ ਆਕਾਰ ਵਿਚ ਵਧਾਉਣਾ ਚਾਹੁੰਦੇ ਹੋ, ਜੋ ਕਿ ਮੂਲ ਰੂਪ ਵਿਚ 1366 ਦੁਆਰਾ 728 ਪਿਕਸਲ ਹੈ, ਤਾਂ ਬਰਾ browserਜ਼ਰ ਦੀ ਚੌੜਾਈ ਅਤੇ ਉਚਾਈ ਨੂੰ ਵੀ ਮਿਲਾਉਣ ਲਈ ਵਧਾਉਣਾ ਲਾਜ਼ਮੀ ਹੈ.
ਤੁਸੀਂ ਇੱਕ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਨੂੰ ਪਾਸ ਕਰ ਸਕਦੇ ਹੋ ਚਿੱਤਰ ਨੂੰ shownੰਗ ਜਿਵੇਂ ਕਿ ਹੇਠਾਂ ਦਰਸਾਇਆ ਗਿਆ ਹੈ, ਇਹ ਮੁੱਲ ਫਿਰ ਤੁਹਾਡੇ ਗਰੈਬਜ਼ਿਟ ਪਾਈਥਨ ਹੈਂਡਲਰ ਨੂੰ ਵਾਪਸ ਕਰ ਦਿੱਤਾ ਜਾਵੇਗਾ. ਉਦਾਹਰਣ ਵਜੋਂ ਇਹ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਇੱਕ ਡੇਟਾਬੇਸ ਪਛਾਣਕਰਤਾ ਹੋ ਸਕਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਸਕ੍ਰੀਨਸ਼ਾਟ ਨੂੰ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਡਾਟਾਬੇਸ ਰਿਕਾਰਡ ਨਾਲ ਜੋੜਿਆ ਜਾ ਸਕਦਾ ਹੈ.
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.customId = "123456" grabzIt.URLToImage("https://www.tesla.com", options) # Then call the Save method grabzIt.Save("http://www.example.com/handler.py")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.customId = "123456" grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options) # Then call the Save method grabzIt.Save("http://www.example.com/handler.py")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.customId = "123456" grabzIt.FileToImage("example.html", options) # Then call the Save method grabzIt.Save("http://www.example.com/handler.py")
GrabzIt ਤੁਹਾਨੂੰ ਇੱਕ ਪੂਰੇ ਵੈੱਬ ਪੇਜ ਦੀ ਪੂਰੀ ਲੰਬਾਈ ਦਾ ਸਕ੍ਰੀਨਸ਼ਾਟ ਲੈਣ ਦੀ ਆਗਿਆ ਦਿੰਦਾ ਹੈ ਅਜਿਹਾ ਕਰਨ ਲਈ ਤੁਹਾਨੂੰ ਇੱਕ -1 ਨੂੰ ਪਾਸ ਕਰਨ ਦੀ ਜ਼ਰੂਰਤ ਹੈ browserHeight
ਗੁਣ. ਇਹ ਨਿਸ਼ਚਤ ਕਰਨ ਲਈ ਕਿ ਚਿੱਤਰ ਬਰਾ theਜ਼ਰ ਦੇ ਆਕਾਰ ਨਾਲ ਮੇਲ ਖਾਂਦਾ ਹੈ ਇਸ ਨੂੰ ਇੱਕ -1 ਪਾਸ ਕਰਦਾ ਹੈ height
ਅਤੇ width
ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.browserHeight = -1 options.width = -1 options.height = -1 grabzIt.URLToImage("https://www.tesla.com", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.browserHeight = -1 options.width = -1 options.height = -1 grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.browserHeight = -1 options.width = -1 options.height = -1 grabzIt.FileToImage("example.html", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")
ਤੁਸੀਂ ਥੰਬਨੇਲ ਵੀ ਵਾਪਸ ਕਰ ਸਕਦੇ ਹੋ ਜੋ ਕੱਟੇ ਨਹੀਂ ਹੋਏ ਹਨ, ਪਰ ਸਾਵਧਾਨ ਰਹੋ ਇਹ ਵੱਡੀਆਂ ਤਸਵੀਰਾਂ ਬਣਾ ਸਕਦਾ ਹੈ. ਅਜਿਹਾ ਕਰਨ ਲਈ ਇੱਕ ਨੂੰ -1 ਪਾਸ ਕਰੋ height
ਅਤੇ / ਜਾਂ width
ਗੁਣ. ਉਹ ਮਾਪ ਜੋ ਐਕਸ-ਐੱਨ.ਐੱਨ.ਐੱਮ.ਐੱਮ.ਐਕਸ ਪਾਸ ਕੀਤਾ ਗਿਆ ਹੈ ਨੂੰ ਕੱਟਿਆ ਨਹੀਂ ਜਾਏਗਾ.
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.width = -1 options.height = -1 grabzIt.URLToImage("https://www.tesla.com", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.width = -1 options.height = -1 grabzIt.HTMLToImage("<html><body><h1>Hello World!</h1></body></html>", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") options = GrabzItImageOptions.GrabzItImageOptions() options.width = -1 options.height = -1 grabzIt.FileToImage("example.html", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")
ਇਨ੍ਹਾਂ ਵਿਸ਼ੇਸ਼ ਕਦਰਾਂ ਕੀਮਤਾਂ ਦੀ ਵਰਤੋਂ ਕਰਨ ਦਾ ਮਤਲਬ ਇਹ ਹੈ ਕਿ ਤੁਸੀਂ ਇੱਕ ਸਕ੍ਰੀਨਸ਼ਾਟ ਬਣਾ ਸਕਦੇ ਹੋ ਜੋ ਤੁਸੀਂ ਚਾਹੁੰਦੇ ਹੋ ਤਾਂ ਪੂਰੇ ਵੈੱਬ ਪੇਜ ਦਾ ਇੱਕ ਪੂਰਾ ਪੈਮਾਨਾ ਵਰਜ਼ਨ ਹੈ!
ਗਰੈਬਜ਼ਿਟ ਤੁਹਾਨੂੰ ਐਚਟੀਐਮਐਲ ਐਲੀਮੈਂਟ ਦਾ ਸਕ੍ਰੀਨਸ਼ਾਟ ਲੈਣ ਦੀ ਆਗਿਆ ਦਿੰਦਾ ਹੈ, ਜਿਵੇਂ ਕਿ div
or span
ਇਸ ਦੀ ਸਾਰੀ ਸਮੱਗਰੀ ਨੂੰ ਟੈਗ ਅਤੇ ਕੈਪਚਰ ਕਰੋ. ਇਹ ਕਰਨ ਲਈ, HTML ਐਲੀਮੈਂਟ ਜਿਸ ਦਾ ਤੁਸੀਂ ਸਕਰੀਨ ਸ਼ਾਟ ਲੈਣਾ ਚਾਹੁੰਦੇ ਹੋ, ਇੱਕ ਦੇ ਤੌਰ ਤੇ ਨਿਰਧਾਰਤ ਕੀਤਾ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ CSS ਚੋਣਕਾਰ.
... <div id="features"> <img src="http://www.example.com/race.jpg"/><h3>Car Race Tommorow</h3> </div> ...
ਹੇਠਾਂ ਦਿੱਤੀ ਉਦਾਹਰਣ ਲਈ ਅਸੀਂ ਆਈਡੀ "ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ" ਨਾਲ ਡਿਵ ਦੀ ਚੋਣ ਕਰਾਂਗੇ ਅਤੇ ਇਸਨੂੰ 250 x 250px JPEG ਚਿੱਤਰ ਦੇ ਰੂਪ ਵਿੱਚ ਆਉਟਪੁੱਟ ਕਰਾਂਗੇ.
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") # The 250 parameters indicates that image should be sized to 250 x 250 px options = GrabzItImageOptions.GrabzItImageOptions() options.width = 250 options.height = 250 options.format = "jpg" options.targetElement = "#features" grabzIt.URLToImage("http://www.bbc.co.uk/news", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")
ਅਗਲੀ ਉਦਾਹਰਣ "ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ" ਡਿਵ ਦਾ ਇੱਕ ਹੋਰ ਸਕ੍ਰੀਨਸ਼ਾਟ ਲੈਂਦੀ ਹੈ ਪਰ ਇਸ ਵਾਰ ਇੱਕ ਜੇਪੀਈਜੀ ਚਿੱਤਰ ਨੂੰ ਬਾਹਰ ਕਰ ਦਿੰਦਾ ਹੈ ਜੋ ਕਿ ਦਿਵ ਦਾ ਸਹੀ ਅਕਾਰ ਹੈ.
from GrabzIt import GrabzItImageOptions from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") # The -1 indicates that image should not be cropped options = GrabzItImageOptions.GrabzItImageOptions() options.width = 250 options.height = 250 options.browserHeight = -1 options.format = "jpg" options.targetElement = "#features" grabzIt.URLToImage("http://www.bbc.co.uk/news", options) # Then call the Save or SaveTo method grabzIt.SaveTo("result.jpg")