{"id":91,"date":"2013-02-12T23:01:49","date_gmt":"2013-02-13T04:01:49","guid":{"rendered":"http:\/\/www.mbeckler.org\/blog\/?p=91"},"modified":"2013-05-31T16:14:03","modified_gmt":"2013-05-31T20:14:03","slug":"script-to-easily-post-screenshot-to-web","status":"publish","type":"post","link":"https:\/\/www.mbeckler.org\/blog\/?p=91","title":{"rendered":"Script to easily post screenshot to web"},"content":{"rendered":"<p>As part of my work with <a href=\"http:\/\/www.wayneandlayne.com\/\">Wayne and Layne<\/a>, Adam and I do a lot of work together remotely, since I live in Pennsylvania and he lives in Minnesota. It&#8217;s really nice to be able to quickly share a work in progress, whether it be a diagram in <a href=\"http:\/\/inkscape.org\/\">Inkscape<\/a> or a printed circuit board layout in <a href=\"http:\/\/www.kicad-pcb.org\/\">Kicad<\/a>. Setting up a Skype or other screen sharing system incurs too much transaction cost and isn&#8217;t very quick, so I was looking for something quicker and simpler.<\/p>\n<p>I wrote this little script to take a screenshot of my entire display, add a timestamp to the bottom, and automatically upload it to my website. I set up an SSH key between my computer and my webserver (that is unlocked when I login), and added the following script to my path as <strong>screenshot_poster.sh<\/strong><\/p>\n<p><code>#!\/bin\/bash<br \/>\n#<br \/>\n# This script will capture the whole screen<br \/>\n# and upload it to the web in a known location<br \/>\n# Written by Matthew Beckler for Wayne and Layne, LLC<br \/>\n# Last updated August 31, 2012<\/p>\n<p>cd \/tmp<br \/>\nimport -window root temp.png<br \/>\nWIDTH=`identify -format %w temp.png`<br \/>\nDATE=`date`<br \/>\nconvert -background '#0008' -fill white -gravity west -size ${WIDTH}x30 caption:\"$DATE\" temp.png +swap -gravity south -composite screenshot.png<br \/>\nscp screenshot.png user@example.com:\/var\/www\/rest\/of\/the\/path\/to\/screenshot.png<\/p>\n<p>DEST=\"http:\/\/example.com\/path\/to\/screenshot.png\"<br \/>\n# do you want a notification or to just open the browser?<br \/>\n#notify-send -t 1000 \"Screenshot posted\" \"$DEST\"<br \/>\nxdg-open \"$DEST\"<br \/>\n<\/code><\/p>\n<p>The final two lines allow you to make a little desktop notification of the URL, open a web browser to the image&#8217;s location, or both. Someday I will set up a nice keyboard shortcut to run this script, to make the process of sharing my work-in-progress as quick and easy as possible.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"96\" data-permalink=\"https:\/\/www.mbeckler.org\/blog\/?attachment_id=96\" data-orig-file=\"https:\/\/www.mbeckler.org\/blog\/wp-content\/uploads\/2013\/02\/screenshot.png\" data-orig-size=\"600,422\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"screenshot\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.mbeckler.org\/blog\/wp-content\/uploads\/2013\/02\/screenshot.png\" src=\"https:\/\/www.mbeckler.org\/blog\/wp-content\/uploads\/2013\/02\/screenshot.png\" alt=\"screenshot\" width=\"600\" height=\"422\" class=\"alignnone size-full wp-image-96\" srcset=\"https:\/\/www.mbeckler.org\/blog\/wp-content\/uploads\/2013\/02\/screenshot.png 600w, https:\/\/www.mbeckler.org\/blog\/wp-content\/uploads\/2013\/02\/screenshot-300x211.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As part of my work with Wayne and Layne, Adam and I do a lot of work together remotely, since I live in Pennsylvania and he lives in Minnesota. It&#8217;s really nice to be able to quickly share a work in progress, whether it be a diagram in Inkscape or a printed circuit board layout [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[52,10],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-bash","tag-linux"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2BznB-1t","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=91"}],"version-history":[{"count":10,"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":146,"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions\/146"}],"wp:attachment":[{"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mbeckler.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}