#] #] ********************* #] "$d_SysMaint"'images/0_image notes.txt' # www.BillHowell.ca 20Sep2020 initial # view in text editor, using constant-width font (eg courier), tabWidth = 3 see also : "$d_web"'Neural nets/TrNNs_ART/0_TrNNs_ART TblOfContents.txt' "$d_web"'Neural nets/TrNNs_ART/0_TrNNs_ART [ToDos, html, Kindle].txt' "$d_bin"'TrNNS-ART run bash scripts.sh.link.txt' "$d_SysMaint"'images/0_image notes.txt' "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' "$d_web"'Neural nets/TrNNs_ART/0_TrNNs_ART notes.txt' #48************************************************48 #24************************24 # Table of Contents, generate with : # $ grep "^#]" "$d_SysMaint"'images/0_image notes.txt' | sed "s/^#\]/ /" # ********************* "$d_SysMaint"'images/0_image notes.txt' +-----+ Setup, ToDos, manual capture html view from browser, avoid [fmt, convert -annotate] +-----+ 29Aug2023 wmctrl -i -r -c doesn't work, try xdotool 28Aug2023 ImageMagic import, https://imagemagick.org/script/import.php 27Aug2023 can't find previous code!!?!? "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' 21Aug2023 No window was specified, bash "$goApp" : "'""$d_temp""'" "'""$fCaptionRefcHtml""'" 21Aug2023 start.sh etc - see "$d_bin"'starter/0_start notes.txt' 21Aug2023 screenCapture pCaptionRefcHtml, vertical combine [image, caption] 20Aug2023 nyet scrot!: "Linux scrot screenshot and how do I specify an area of the screen?" 20Aug2023 search "Linux command line screenshot of an area of the screen?" 20Aug2023 pHtml_refc_to_pPng() in "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' 20Aug2023 search "Linux and how do I get the width, height of an image?" 19Aug2023 search "Linux browser window screen capture" 19Aug2023 retain caption formatting - screencapture firefox? 19Aug2023 does it work following unsafe changes to '/etc/ImageMagick-6/policy.xml'? Use of convert & over-ride security risks 18Aug2023 search some more "Linux command line and how do I convert text to image?" 18Aug2023 search "Linux command line and how do I convert text to image?" 18Aug2023 search "Linux and how do I catenate images?" 20Jun2023 minimalist image viewers 13Nov2021 QR code reader - command line version, Python-zbarpygtk #24************************24 #] +-----+ #] Setup, ToDos, #] 30Oct2023 can I specify winID, rather than have it assigned by winID=$( winID_last )? #] 30Aug2023 ToDos for 'image: put [cap, ref]s on [fig, tbl]s.sh' imgCap sideBar nomenclature : others? (done: p520fig14.02, p552fig15.23) many have too thick a bottom white margin, leave it for now probably too much txtHeight? let "captionPixHeight = $nLines * 25 + 80" noCap : fig 04.04, 11.30 noImg : see pLnkFail caption cut off : fig 04.53 (1/2 sentence), 05.07 (1/2 chr). 05.13 (edge), 05.48 (words), 08.07 (chr), 08.12 (chr), 11.37 (word), 11.38 (word), 11.39 (1/2 word), 12.61 (chr), 13.08 (1/2 sentence), 13.13 (2-4 words), 13.16 (edge), 13.17 (2-4 chrs), 13.19 (chr), 13.20 (2-4 chr), 13.22 (2 chr), 13.40 (1/2 word), 13.42 (2-4 chr), 13.42 (chr), 13.43 (chr), 14.03 (last several lines including reference), 15.03 (several words), 15.09 (chr), 15.24 (chr), 16.04 (edge last line), 16.42 (bottom line reference), 16.45 (2 words), 17.01 (word), #] screen capture browser html.sh #] manual capture html view from browser, avoid [fmt, convert -annotate] combine [Andrew Garcia, Ciro Santilli] (below) : convert image1.png image2.png -append joined_vertical.png horizontal 500px height : convert +append image_1.png image_2.png -resize x500 new_image_conbined.png vertical 500px width : convert -append image_1.png image_2.png -resize 500x new_image_conbined.png #] +-----+ #24************************24 #08********08 #] ??Oct2023 #08********08 #] ??Oct2023 #08********08 #] ??Oct2023 #08********08 #] ??Oct2023 #08********08 #] ??Oct2023 #08********08 #] 29Aug2023 wmctrl -i -r -c doesn't work, try xdotool Software Manager : downloaded xdotool from "$d_SysMaint"'Linux/xdotool notes.txt' : 'xdotool key --window ' winID ' ctrl+shift+w' see "$d_SysMaint"'Linux/xdotool notes.txt' >> works great! 30Aug2023 speed up image-caption process, run on sample, then all initial test set : "$d_TrNNs_ART"'captions html/0_pCaptionL test 1.01-1.07.txt' new test set : "$d_TrNNs_ART"'captions html/0_pCaptionL test 1.08-1.25.txt' /home/bill/web/ProjMini/TrNNs_ART/captions html/0_pCaptionL test 1.08-1.25.txt $ bash "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' +-----+ captions html/p012fig01.08 Sigmoidal signal: a hybrid of [same, slower, faster]-than-linear.html captions html/p013fig01.09 sigmoid signal: quenching threshold; contrast enhancement.html captions html/p016fig01.10 Minimal adaptive prediction: blocking and unblocking.html ... fine up to : captions html/p032fig01.21 [Retina, LGNs, V[1,2,3,4], MT] to What & Where areas.html ... problem!!!! /home/bill/web/bin/image: put [cap, ref]s on [fig, tbl]s.sh: line 155: [: /home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png: cannot open `/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png' (No such file or directory): integer expression expected /home/bill/web/bin/image: put [cap, ref]s on [fig, tbl]s.sh: line 158: let: lineChrLen = /home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png: cannot open `/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png' (No such file or directory) / 7: syntax error: operand expected (error token is "/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png: cannot open `/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png' (No such file or directory) / 7") /home/bill/web/bin/image: put [cap, ref]s on [fig, tbl]s.sh: eval: line 187: unexpected EOF while looking for matching ``' /home/bill/web/bin/image: put [cap, ref]s on [fig, tbl]s.sh: eval: line 188: syntax error: unexpected end of file /home/bill/web/bin/image: put [cap, ref]s on [fig, tbl]s.sh: line 194: let: captureWidth = /home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png: cannot open `/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png' (No such file or directory) * 130 / 100: syntax error: operand expected (error token is "/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png: cannot open `/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png' (No such file or directory) * 130 / 100") convert-im6.q16: unable to open image `/home/bill/web/ProjMini/TrNNs_ART/images- Grossberg 2021/p035fig01.22 Presentation [normal, silence, noise replaced].png': No such file or directory @ error/blob.c/OpenBlob/2924. ... rest OK : captions html/p036fig01.23 working memory [longer list, bigger chunk]s.html captions html/p037fig01.24 sentence [learn, store, class] via 3 streams.html captions html/p038fig01.25 ART Matching Rule stabilizes learning: [real time learn, object attention].html +-----+ >> "workable", but does cut off some captions, often too large white space margins, etc >> chopped captions, often just a character : fig : 01.08, 01.10, 01.12, 01.14, 01.16, 01.19, 01.22 (no image!!), 01.23, tbl : 01.01, 01.02, "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' dir_fHtml_refc_to_pPng() changed : let "captureWidth = $width * 135 / 100" # [from, to] : [130, 135]; >> still chopped : fig : tbl : 01.01, 01.02, +-----+ olde code # for cmd, see "$d_bin""starter/start0_app.sh" # delay appln dir filnm # echo "d_temp = '""$d_temp""'" # echo "fCaptionRefcHtml = '""$fCaptionRefcHtml""'" # + 150; + 250; + 300" #08********08 #] 28Aug2023 ImageMagic import, https://imagemagick.org/script/import.php https://imagemagick.org/script/command-line-options.php#crop -crop geometry{@}{!} Cut out one or more rectangular regions of the image. See Image Geometry for complete details about the geometry argument. The width and height of the geometry argument give the size of the image that remains after cropping, and x and y in the offset (if present) gives the location of the top left corner of the cropped image with respect to the original image. To specify the amount to be removed, use -shave instead. If the x and y offsets are present, a single image is generated, consisting of the pixels from the cropping region. The offsets specify the location of the upper left corner of the cropping region measured downward and rightward with respect to the upper left corner of the image. If the -gravity option is present with NorthEast, East, or SouthEast gravity, it gives the distance leftward from the right edge of the image to the right edge of the cropping region. Similarly, if the -gravity option is present with SouthWest, South, or SouthEast gravity, the distance is measured upward between the bottom edges. If the x and y offsets are omitted, a set of tiles of the specified geometry, covering the entire input image, is generated. The rightmost tiles and the bottom tiles are smaller if the specified geometry extends beyond the dimensions of the input image. You can add the @ to the geometry argument to equally divide the image into the number of tiles generated. By adding a exclamation character flag to the geometry argument, the cropped images virtual canvas page size and offset is set as if the geometry argument was a viewport or window. This means the canvas page size is set to exactly the same size you specified, the image offset set relative top left corner of the region cropped. If the cropped image 'missed' the actual image on its virtual canvas, a special single pixel transparent 'missed' image is returned, and a 'crop missed' warning given. It might be necessary to +repage the image prior to cropping the image to ensure the crop coordinate frame is relocated to the upper-left corner of the visible image. Similarly you may want to use +repage after cropping to remove the page offset that will be left behind. This is especially true when you are going to write to an image format such as PNG that supports an image offset. +-----+ from "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' : # import -window root -quality 100 "$pCaptionPng" # import -window root -crop 200x300+100+15 -quality 100 "$pCaptionPng" >> entire screen #import -window "$win_id" -crop "$captureWidth"x"$capturePxHgh" + "$captureWidth" + "$headerOffset" -quality 100 "$pCaptionPng" #import -geometry -crop "$captureWidth"x"$capturePxHgh" + "$captureWidth" + "$headerOffset" -quality 90 "$pCaptionPng" import -window "$win_id" -crop "$captureWidth"x"$capturePxHgh"+"$xOffset"+"$yOffset" -quality 90 "$pCaptionPng" # convert -append "$pGrossbgPng" "$pCaptionPng" -resize 500x "$pCaptionPng" # pCaptionTmpPng="$d_temp"'pCaptionTmpPng.png' # 2 * $height_menu_top + 40" # + $height_menu_btm" let "hdrHi = 100" #08********08 #] 27Aug2023 can't find previous code!!?!? "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' see "$d_bin"'screen capture browser html.sh' "$flagBR" == '
' $ find "$d_Qroot" -type f \( -name "*.ndf" -o -name "*.txt" \) | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number '"$flagBR" == ' "FILE" | sed "s|$d_Qroot||;s|:.*||" | sort -u >"$d_temp"'find-grep-sed temp.txt' $ find "$d_bin" -type f \( -name "*.sh" -o -name "*.txt" \) | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number 'flagBR' "FILE" >"$d_temp"'find-grep-sed temp.txt' $ find "$d_ProjMini" -type f \( -name "*.sh" -o -name "*.txt" \) | grep --invert-match "z_Old" | grep --invert-match "z_Archive" | sort | tr \\n \\0 | xargs -0 -IFILE grep --with-filename --line-number 'flagBR' "FILE" >"$d_temp"'find-grep-sed temp.txt' #08********08 #] 21Aug2023 No window was specified, bash "$goApp" : "'""$d_temp""'" "'""$fCaptionRefcHtml""'" #] 21Aug2023 start.sh etc - see "$d_bin"'starter/0_start notes.txt' #] 21Aug2023 screenCapture pCaptionRefcHtml, vertical combine [image, caption] +-----+ screenCapture pCaptionRefcHtml try : import -window root -crop "$width"x"$captionPixHeight"+100+15 -quality 100 "$pCaptionPng" wrong window, offsets import -window root -crop "$width"x"$captionPixHeight"+100+15 -quality 100 "$pCaptionPng" try : let "captionArea = $height_menu_top + $height_menu_btm" import -window "$win_id" -crop "$width"x"$captionPixHeight"+"$captionArea" -quality 100 "$pCaptionPng" let "headerHight = $height_menu_top + $height_menu_btm" import -window "$win_id" -crop "$width"x"$captionPixHeight"+0+"$headerHight" -quality 100 "$pCaptionPng" >> close!! just not wide enough import -window "$win_id" -crop "$width"x"$captionPixHeight"+100+"$headerHight" -quality 100 "$pCaptionPng" >> now front part is chopped, increase width for win_id capture try 300 >> great, a bit too wide, but leave it at that change to : let "width = width + 300" let "headerHight = $height_menu_top + $height_menu_btm" import -window "$win_id" -crop "$width"x"$captionPixHeight"+0+"$headerHight" -quality 100 "$pCaptionPng" >> works, 300 is too much, but leave it there back to append... convert -append "$pGrossbgPng" "$pCaptionPng" "$pCaptionPng" >> OK width is good, too large a bit, but header is showing - I should have noticed this before change : winPosnSize="0,985,0,$width,$captionPixHeight" let "headerOffset = $height_menu_top + $height_menu_top + $height_menu_btm" to : winPosnSize="0\,985\,0\,$width\,$captionPixHeight" let "headerOffset = $height_menu_top + $height_menu_btm" change to : winPosnSize="0,985,0,$width,$captionPixHeight" echo "winPosnSize = $winPosnSize" cmd='wmctrl -i -r '"$win_id"' -e '"$winPosnSize" echo "cmd = $cmd" eval "$cmd" change to : let "width = width + 300" let "headerOffset = $height_menu_top + $height_menu_top + $height_menu_btm" import -window "$win_id" -crop "$width"x"$captionPixHeight"+"$headerOffset"+"$headerHight" -quality 100 "$pCaptionPng" >> not enough change : let "captionPixHeight = $nLines * 30 + $height_menu_top + $height_menu_btm" import -window "$win_id" -crop "$width"x"$captionPixHeight"+"$headerOffset"+"$headerHight" -quality 100 "$pCaptionPng" to : let "captionPixHeight = $nLines * 30" import -window "$win_id" -crop "$width"x"$captionPixHeight"+"$width"+"$headerOffset" -quality 100 "$pCaptionPng" import-im6.q16: geometry does not contain image `/home/bill/web/ProjMini/TrNNs_ART/images- captioned/p024fig01.15 READ circuit: REcurrent Associative Dipole.png' @ warning/transform.c/CropImage/668. >> oops??? what now? change to : let "width = width + 300" let "captionPixHeight = $nLines * 30" let "headerOffset = $height_menu_top + $height_menu_top + $height_menu_btm" echo "width = $width" echo "headerOffset = $headerOffset" import -window "$win_id" -crop "$width"x"$captionPixHeight"+"$width"+"$headerOffset" -quality 100 "$pCaptionPng" +-----+ vertical combine [image, caption] convert -append "$pGrossbgPng" "$pCaptionPng" "$pCaptionPng" >> appends, but captionHtmlPng shifted mostly to leaft (chops initial part) pCaptionTmpPng="$d_temp"'pCaptionTmpPng.png' convert -append "$pGrossbgPng" "$pCaptionPng" "$pCaptionTmpPng" >> same problem >> Wow! "$pCaptionPng" now chopped as shown in append img!!??!! Double-check pre-append img >> it looks like the culprit is xOffset "300" - set to 0 #08********08 #] 20Aug2023 nyet scrot!: "Linux scrot screenshot and how do I specify an area of the screen?" very trickey handling wmctrl parameters - construct '' and "" parts as cmd - eval "$cmd" example: pHtml_refc_to_pPng() - convert ONE html (text markup) file to png image winPosnSize='0,980,0,'"$width"','"$captionPixHeight"' ' echo "winPosnSize = $winPosnSize" cmd='wmctrl -i -r '"$win_id"' -e '"$winPosnSize"' ' echo "cmd = $cmd" eval "$cmd" >> YEAH! finally got something to work!!! win_id="0x0329734e" winPosnSize='0,980,0,332,165' wmctrl -i -r "$win_id" -e "$win_PosnSize" wmctrl -i -r "$win_id" -e 0,980,0,332,350 wmctrl -i -r "$win_id" -e 0,980,0,332,200 wmctrl -i -r "$win_id" -e 0,980,0,332,250 wmctrl -i -r "$win_id" -e 0,980,0,332,230 wmctrl -i -r "$win_id" -e [ "$win_PosnSize"] winPosnSize='0,980,0,332,400' cmd='wmctrl -i -r '"$win_id"' -e '"$winPosnSize"' ' >> OK $ winPosnSize='0,980,0,332,165' $ cmd='wmctrl -i -r '"$win_id"' -e '"$winPosnSize"' ' $ echo "$cmd" wmctrl -i -r 0x0329734e -e 0,980,0,332,165 $ eval "$cmd" >> OK window resized # https://stackoverflow.com/questions/4670013/fast-way-to-get-image-dimensions-not-filesize # edited Feb 20, 2021 at 20:43 # answered Jan 12, 2011 at 15:18 # ypnos # https://www.baeldung.com/linux/image-dimensions # Last updated: May 5, 2023 # Written by: baeldung # 20Aug2021 intial didn't work at all : echo 'scrot image capture' scrot -u --autoselect "0,$height_menu_top,$width,$captionPixHeight" pOut=$( find ~ -maxdepth 1 -type f -name "*_scrot.png" ) echo "pOut = $pOut" mv "pOut" "$pCaptionPng" +-----+ olde code # "$fCaptionPng" # 28May2018 RaspPi : # lxterminal --command="PS1=\"\\w\\n$ \"" #>> LXterminal windows opens, but [frozen,inactive] # lxterminal --command="PS1='\w\n$ '" #>> LXterminal windows opens, but [frozen,inactive] # lxterminal --working-directory="/media/bill/SWAPPER/bin/starter/" #>> Works! (but not-so-useful to me) # command='PS1="\w\n$ "' # $ echo "$command" # PS1="\w\n$ " #>> Works! # command="'PS1="\w\n$ "'" # $ echo "$command" # PS1="\w\n$ " #>> Works! # $ command="'PS1="\w\n$ "'" # bash: ': command not found # BAD #wmctrl -i -r "$win_id" -e "$win_PosnSize" #win_id=$( win_id_last ) # echo "win_id = $win_id" # win_move_last "$winPosnSize" # wmctrl option -a = Switch to the desktop containing the window , raise the window, and give it focus. # win_id - already on hand from win_move_last() # echo "win_id before raise to top = $win_id" # wmctrl -a "$win_id" # echo "win_id after raise to top = $win_id" # echo 'p024fig01.15 A REcurrent Associative Dipole, or READ, circuit is a recurrent shunting on-center off-surround network with habituative transmitter gates. Sensory cues sample it with LTM traces and thereby become conditioned reinforcers.
|| and a bindch of other stuff' | wc -m # echo 'p024fig01.15 A REcurrent Associative Dipole, or READ, circuit is a recurrent shunting on-center off-surround network with habituative transmitter gates. Sensory cues sample it with LTM traces and thereby become conditioned reinforcers.
|| and a bindch of other stuff' | sed 's#\(.*\)[|][|].*#\1#' # echo 'p024fig01.15 A REcurrent Associative Dipole, or READ, circuit is a recurrent shunting on-center off-surround network with habituative transmitter gates. Sensory cues sample it with LTM traces and thereby become conditioned reinforcers.
' | sed 's|.*\(
\)$|\1|' #
# >> OK # echo 'p024fig01.15 A REcurrent Associative Dipole, or READ, circuit is a recurrent shunting on-center off-surround network with habituative transmitter gates. Sensory cues sample it with LTM traces and thereby become conditioned reinforcers.' | sed 's|.*\(
\)$|\1|' # null # >> OK # flagBR=$( echo 'p024fig01.15 A REcurrent Associative Dipole, or READ, circuit is a recurrent shunting on-center off-surround network with habituative transmitter gates. Sensory cues sample it with LTM traces and thereby become conditioned reinforcers.
' | sed 's|.*\(
\)$|\1|' ) # echo "$flagBR" #
# >> OK # "$flagBR" == '
' #
: command not found # BR='
' # "$flagBR" == "$BR" #
: command not found # [ "$flagBR" == "$BR" ] # [ "$flagBR" == '
' ] # "$flagBR" == "
" # [[ "$flagBR" == '
' ]] #08********08 #] 20Aug2023 search "Linux command line screenshot of an area of the screen?" Howell - shutter has unmet dependencies - install maybe at a later date scrot - command line screen capture utility +-----+ https://askubuntu.com/questions/585455/taking-screenshot-of-a-specific-area-from-the-command-line +--+ In Lubuntu, you can do exactly what you want: take a screen shot from the command line with the command: scrot_extended 100 100 400 400 using the script below. The four arguments are , , , . I didn't have the chance (yet) to test it in Lubuntu 12.04, but it seems unlikely it wouldn't work; it uses python 2 and basic command line tools that exist for a long time already. Explanation The script: takes a screenshot with scrot saves it into a temporary file using imagemagick, it creates a new image, cropping the screen shot, with the arguments you ran the script with the image is saved into a directory as a numbered file, to prevent overwriting How to use The script uses both scrot and imagemagick. scrot should be on your system. To install imagemagick: sudo apt-get install imagemagick Copy the script into an empty file By default, images are saved to ~/scrot_images, named: outputfile_1.png, outputfile_2.png etc. . Change it if you want, as marked in the script. Note that if you change the diretory, you have to use the full path. Save the file to ~/bin (create the directory if needed) as scrot_extended (no extension) and make it executable. Log out and back in and take your screenshot with the command: scrot_extended Example: scrot_extended 100 100 400 400 enter image description here outputfile: enter image description here The script #!/usr/bin/env python import subprocess import os import sys # setting default directories / filenames home = os.environ["HOME"] temp = home+"/"+".scrot_images" img_in = temp+"/in.png" # if you prefer, you can change the two line below: output_directory = home+"/"+"scrot_images" # output directory filename = "outputfile" # filename # creating needed directories for dr in [temp, output_directory]: if not os.path.exists(dr): os.mkdir(dr) # creating filename (-number) to prevent overwriting previous shots n = 1 while True: img_out = output_directory+"/"+filename+"_"+str(n)+".png" if os.path.exists(img_out): n = n+1 else: break # reading arguments,arranging commands to perform coords = sys.argv[1:5] cmd1 = ["scrot", img_in] cmd2 = ["convert", img_in, "-crop", coords[2]+"x"+coords[3]+"+"+coords[0]+"+"+coords[1], "+repage", img_out] # Take screnshot, crop image for cmd in [cmd1, cmd2]: subprocess.call(cmd) edited Jun 12, 2020 at 14:37 CommunityBot answered Feb 15, 2015 at 10:07 Jacob Vlijm +-----+ https://askubuntu.com/questions/194427/what-is-the-terminal-command-to-take-a-screenshot +--+ You can use shutter program to take screenshot from terminal.Run the below commands in terminal to install shutter, sudo add-apt-repository ppa:shutter/ppa sudo apt-get update sudo apt-get install shutter To take a screenshot of active window, shutter -a -o shot.png -e To take a screenshot of whole display, shutter -f -o shot.png -e The screenshots taken are stored in the home directory. ... answered Dec 30, 2013 at 15:22 Avinash Raj +-----+ https://unix.stackexchange.com/questions/25063/capturing-area-of-the-screen-without-a-desktop-environment +--+ ImageMagick comes with the import utility to take screenshots. It has tons of options, but by default it lets you draw a rectangle on the screen and saves just that portion. If you want an entire window you can use -window ID; the identifier "root" captures the entire screen answered Nov 21, 2011 at 4:31 Michael Mrozek +--+ The euphoniously named scrot takes screenshots from the command line... It has a couple of simple options, including a time delay and image quality. If you are wanting to take a shot in the console, and you are running a framebuffer, then you can use fbgrab. edited Nov 21, 2011 at 4:39 answered Nov 21, 2011 at 3:43 jasonwryan +-----+ https://unix.stackexchange.com/questions/3728/how-to-do-a-print-screen-or-capture-an-area-of-the-screen +--+ Just wrote this small interface to xwd, to make it wait the provided number of seconds before it takes the dump. It seems to work. dumptime () { (sleep $1; xwd -root | convert - `date +%I.%M.%S`.png) & } Also, there are scrot and gnome-screenshot. The ImageMagick import solution in Mr. Mrozek's answer has a famous "black box" bug on -window root - not everyone gets it, but I do. According to this, gnome-screenshot is based on ImageMagick - but it is not a wrapper; I just browsed the code, and it is a big C application. answered Jan 22, 2013 at 2:55 Emanuel Berg #08********08 #] 20Aug2023 pHtml_refc_to_pPng() in "$d_bin"'image: put [cap, ref]s on [fig, tbl]s.sh' +-----+ olde code # shelve it for now - who cares? # txtLen=$( ) # nBR=$( echo "$" | grep -c '
' ) # nLI=$( ) # txtLines=$( "$txtLen" / + "$nBR" + "$nLI" ) # nLines=$( ) #08********08 #] 20Aug2023 search "Linux and how do I get the width, height of an image?" +-----+ https://www.baeldung.com/linux/image-dimensions Find Out Image Dimensions From the Linux Terminal Last updated: May 5, 2023 Written by: baeldung 2. The file Command The file command is available on the majority of Linux distributions. Behind the scenes, it reads the metadata from the headers of the image files, thus providing a performance advantage. We can use the file command followed by image paths to find out the dimensions of images: $ file myimage.jpeg myimage.jpeg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 300x300, segment length 16, Exif Standard: [TIFF image data, little-endian, direntries=7, orientation=upper-left,xresolution=98, yresolution=106, resolutionunit=2, software=GIMP 2.10.24, datetime=2021:07:07 21:18:52], progressive, precision 8, 768x768, components 3 As we can see, it prints the metadata for myimage.jpeg. If we want to grab merely the dimensions of the image, we can grep the output: $ file myimage.jpeg | grep -Eo "[[:digit:]]+ *x *[[:digit:]]+" 768x768 The -E flag will enable extended regular expressions The -o option will print only the text that’s matched However, we should know that the file command will only print dimensions for JPEG, PNG, GIF, WEBP, PGM, and PPM images. +-----+ https://stackoverflow.com/questions/4670013/fast-way-to-get-image-dimensions-not-filesize Fast way to get image dimensions (not filesize) Asked 12 years, 7 months ago Modified 2 years, 6 months ago Viewed 105k times The file command prints the dimensions for several image formats (e.g. PNG, GIF, JPEG; recent versions also PPM, WEBP), and does only read the header. The identify command (from ImageMagick) prints lots of image information for a wide variety of images. It seems to restrain itself to reading the header portion (see comments). It also uses a unified format which file sadly lacks. exiv2 gives you dimensions for many formats, including JPEG, TIFF, PNG, GIF, WEBP, even if no EXIF header present. It is unclear if it reads the whole data for that though. See the manpage of exiv2 for all supported image formats. head -n1 will give you the dimensions for PPM, PGM formats. For formats popular on the web, both exiv2 and identify will do the job. Depending on the use-case you may need to write your own script that combines/parses outputs of several tools. edited Feb 20, 2021 at 20:43 answered Jan 12, 2011 at 15:18 ypnos #08********08 #] 19Aug2023 search "Linux browser window screen capture" +-----+ https://stackoverflow.com/questions/125951/command-line-program-to-create-website-screenshots-on-linux Command line program to create website screenshots (on Linux) [closed] Asked 14 years, 11 months ago Modified 9 years, 8 months ago Viewed 98k times A little more detail might be useful... Start a firefox (or other browser) in an X session, either on your console or using a vncserver. You can use the --height and --width options to set the size of the window to full screen. Another firefox command can be used to set the URL being displayed in the first firefox window. Now you can grab the screen image with one of several commands, such as the "import" command from the Imagemagick package, or using gimp, or fbgrab, or xv. #!/bin/sh # start a server with a specific DISPLAY vncserver :11 -geometry 1024x768 # start firefox in this vnc session firefox --display :11 # read URLs from a data file in a loop count=1 while read url do # send URL to the firefox session firefox --display :11 $url # take a picture after waiting a bit for the load to finish sleep 5 import -window root image$count.jpg count=`expr $count + 1` done < url_list.txt # clean up when done vncserver -kill :11 edited Feb 6, 2013 at 18:10 booleys1012 answered Sep 27, 2008 at 6:52 >> Howell: wow! looks simple man import NAME import - saves any visible window on an X server and outputs it as an image file. You can capture a single window, the entire screen, or any rectangular portion of the screen. SYNOPSIS import-im6.q16 [options] output-file OVERVIEW The import-im6.q16 program is a member of the ImageMagick-ims6.q16(1) suite of tools. Use it to capture some or all of an X server screen and save the image to a file. For more information about the import command, point your browser to file:///usr/share/doc/image‐ magick-6-common/html/www/import.html (on debian system you may install the imagemagick-6 package) or https://www.imagemagick.org/script/import.php. #08********08 #] 19Aug2023 retain caption formatting - screencapture firefox? eg file:///media/bill/ramdisk/fmt%20test%20formatted.html manual : use screen-capture image >> "$d_temp"'fmt test formatted.png' $ convert -append "$d_temp"'cover image.png' "$d_temp"'fmt test formatted.png' "$d_temp"'imageVertcalCombine- cover image, htmlImage.png' >> very broad image - lots of white space, NICE legible! try setting width : $ convert -append "$d_temp"'cover image.png' "$d_temp"'fmt test formatted.png' -resize 517x "$d_temp"'imageVertcalCombine- cover image, htmlImage.png' >> works but text is fuzzified $ convert -append "$d_temp"'cover image.png' "$d_temp"'fmt test formatted.png' -resize 950x "$d_temp"'imageVertcalCombine- cover image, htmlImage.png' >> much more readable text. "Screenshot" screen capture in half-screen-width browser window makes nice text quality - us for all images? prepare for actual image use $ convert -append "$d_ProjMini"'TrNNs_ART/images- Grossberg 2021/cover image.png' "$d_temp"'fmt test formatted.png' -resize 960x "$d_ProjMini"'TrNNs_ART/images- captioned/cover image.png' nyet - keep output in d_temp for now... $ convert -append "$d_ProjMini"'TrNNs_ART/images- Grossberg 2021/cover image.png' "$d_temp"'fmt test formatted.png' -resize 960x "$d_temp"'cover image.png' >> $ convert -append "$d_ProjMini"'TrNNs_ART/images- Grossberg 2021/p002fig01.02 Dalmation in snow.png' "$d_temp"'fmt test formatted.png' -resize 960x "$d_temp"'p002fig01.02 Dalmation in snow.png' >> fuzzy image, but can read text Works for now - just want automated browser screen capture #08********08 #] 19Aug2023 does it work following unsafe changes to '/etc/ImageMagick-6/policy.xml'? FeRD's template : fmt < ascii.txt | convert -size 1000x2000 xc:white -font "DejaVu-Sans-Condensed" \ -pointsize 24 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" \ -border 10 +repage image.png $ cat "$d_temp"'fmt test formatted nohtml.txt' | tr \\n \\0 | xargs -0 -ILINE convert -background lightblue LINE -font Candice -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' $ cat "$d_temp"'fmt test formatted nohtml.txt' | convert -background lightblue -font Candice -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 +repage "$d_temp"'cover image.png' +-----+ convert-im6.q16: unable to open image `p013fig01.09': No such file or directory @ error/blob.c/OpenBlob/2924. convert-im6.q16: no decode delegate for this image format `09' @ error/constitute.c/ReadImage/575. ... convert-im6.q16: TooManyExceptions (exception processing is suspended) @ warning/exception.c/ThrowException/1054. convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/575. +-----+ >> nope, still doesn't work, but new errors. Chokes on one work per input line!?!?? from jimmoj : echo 'Unix&Linux' | xargs -I '{}' convert -background black -fill green -pointsize 84 -font Helvetica label:'{}' test.png $ cat "$d_temp"'fmt test formatted nohtml.txt' | tr \\n \\0 | xargs -0 -ILINE convert -background lightblue LINE -font Candice -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' +-----+ convert-im6.q16: unable to open image `p013fig01.09 A sigmoid signal function generates a quenching': No such file or directory @ error/blob.c/OpenBlob/2924. convert-im6.q16: no decode delegate for this image format `09 A SIGMOID SIGNAL FUNCTION GENERATES A QUENCHING' @ error/constitute.c/ReadImage/575. convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. convert-im6.q16: unable to open image `threshold below which cell activities are treated like noise': No such file or directory @ error/blob.c/OpenBlob/2924. convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/575. convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. convert-im6.q16: unable to open image `and suppressed. Activities that are larger than the quenching': No such file or directory @ error/blob.c/OpenBlob/2924. convert-im6.q16: no decode delegate for this image format ` ACTIVITIES THAT ARE LARGER THAN THE QUENCHING' @ error/constitute.c/ReadImage/575. convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. convert-im6.q16: unable to open image `threshold are contrast enhanced and stored in short-term': No such file or directory @ error/blob.c/OpenBlob/2924. convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/575. convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. convert-im6.q16: unable to open image `memory.': No such file or directory @ error/blob.c/OpenBlob/2924. convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/575. convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. +-----+ >> much shorter list of errors - lines only, not individual words $ cat "$d_temp"'fmt test formatted nohtml.txt' | convert -background lightblue -font Candice -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 +repage '/media/bill/ramdisk/cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. search "Linux convert and "@-"" +-----+ https://imagemagick.org/Usage/text/ ImageMagick Examples -- Text to Image Handling Special Escape Characters in Text Arguments For example, here I set and the report an images 'label' and 'comment' meta-data using the two methods to set that information from a source text file. The "info.txt" file contains the string [IM Text], (no final newline). magick -label @info.txt rose: -format '%l label' info: magick -comment @info.txt rose: -format '%c set "' info: magick rose: -set label @info.txt -format '%l caption' info: magick rose: -set comment @info.txt -format '%c set "' info: +-----+ http://www.imagemagick.org/script/command-line-options.php#annotate Annotate an image with text This is a convenience for annotating an image with text. For more precise control over text annotations, use -draw. The values Xdegrees and Ydegrees control the shears applied to the text, while tx and ty are offsets that give the location of the text relative any -gravity setting and defaults to the upper left corner of the image. Using -annotate degrees or -annotate degreesxdegrees produces an unsheared rotation of the text. The direction of the rotation is positive, which means a clockwise rotation if degrees is positive. (This conforms to the usual mathematical convention once it is realized that the positive y–direction is conventionally considered to be downward for images.) The new (transformed) coordinates (x', y') of a pixel at position (x, y) in the image are calculated using the following matrix equation. annotate transformation If tx and ty are omitted, they default to 0. This makes the bottom-left of the text becomes the upper-left corner of the image, which is probably undesirable. Adding a -gravity option in this case leads to nice results. Text is any UTF-8 encoded character sequence. If text is of the form '@mytext.txt', the text is read from the file mytext.txt. Text in a file is taken literally; no embedded formatting characters are recognized. >> format '@mytext.txt' won't work with my paths-with-spaces $ cat "$d_temp"'fmt test formatted nohtml.txt' | convert -background lightblue -font Candice -pointsize 10 -fill black -annotate +15+30 @- -trim -bordercolor "#FFF" -border 10 +repage "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. try replacing spaces with _ in fname: useless for stdin? try creating text image first, then convert to verticalJoin $ cat "$d_temp"'fmt test formatted nohtml.txt' | convert -background lightblue -font Candice -pointsize 10 -fill black "$d_temp"'cover image.png' #] Use of convert & over-ride security risks https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion sudo geany '/etc/ImageMagick-6/policy.xml' Change : To: reboot machine reverse to re-secure LMDE >> lot of [time, work] because of reboot! #08********08 #] 18Aug2023 search some more "Linux command line and how do I convert text to image?" +-----+ https://unix.stackexchange.com/questions/294957/print-text-file-to-images-with-layout-from-command-line "Print" text file to images with layout from command line Asked 7 years, 1 month ago Modified 7 years, 1 month ago Viewed 3k times A traditional tool for printing simple text files is enscript. This produces PostScript output. You can convert this to an image in many ways. One that gives good results is pdftopng which needs the PostScript packaged into a pdf as input (eg with ps2pdf) and produces png image files. So, using convert from ImageMagick to convert to jpg you end up with: enscript < myfile.txt --media A4 -f CourierBold10 -o - | ps2pdf - >out.pdf pdftopng -mono out.pdf out # creates files out-000001.png etc for f in out-*.png do convert -resize 600x872 "$f" "${f/png/jpg}" rm "$f" done rm out.pdf Your output is in files out*jpg. Share Improve this answer Follow answered Jul 10, 2016 at 16:14 meuh's user avatar meuh >> interesting approach, but need better? +-----+ https://unix.stackexchange.com/questions/395074/imagemagick-convert-text-to-image-readtextimage-assertion Your test command works for me, it looks that your system lacks something. Anyway, the text format is used rather for paging text on multiple pages. If your goal is to create an image from a short plain text you can try the label format: convert -background black -fill green -pointsize 84 \ -font Helvetica label:'Unix&Linux' test.png Additionally, you may find xargs handy if your text comes from the other command and you need to pipe it to the convert (as in the question): echo 'Unix&Linux' | xargs -I '{}' convert -background black -fill green \ -pointsize 84 -font Helvetica label:'{}' test.png You may find many useful examples on the Imagemagick site. ... edited Sep 29, 2017 at 0:06 answered Sep 28, 2017 at 23:15 jimmij Howell: try $ convert -background black -fill green -pointsize 84 -font Helvetica label:'Unix&Linux' "$d_temp"'cnvert text test.png' >> that worked!! (first to work so far) $ echo 'p013fig01.09 A sigmoid signal function generates a quenching threshold below which cell activities are treated like noise and suppressed. Activities that are larger than the quenching threshold are contrast enhanced and stored in short-term memory.
|| Quenching threshold xi(o) vs i.
fXi(∞)= xi(∞)/sum[j: xj(∞)]x(∞)
sigmoidtunable filter
stores infinitely many contrast-enhanced patterns
suppresses noise
' | xargs -I '{}' convert -background black -fill green -pointsize 84 -font Helvetica label:'{}' "$d_temp"'convert pipe text test.png' convert-im6.q16: no images defined `/media/bill/ramdisk/convert pipe text test.png' @ error/convert.c/ConvertImageCommand/3229. $ convert -background black -fill green -pointsize 84 -font Helvetica label:'p013fig01.09 A sigmoid signal function generates a quenching threshold below which cell activities are treated like noise and suppressed. Activities that are larger than the quenching threshold are contrast enhanced and stored in short-term memory.
|| Quenching threshold xi(o) vs i.
fXi(∞)= xi(∞)/sum[j: xj(∞)]x(∞)
sigmoidtunable filter
stores infinitely many contrast-enhanced patterns
suppresses noise
' "$d_temp"'convert pipe text test.png' @ error/label.c/ReadLABELImage/143. convert-im6.q16: no images defined `/media/bill/ramdisk/convert pipe text test.png' @ error/convert.c/ConvertImageCommand/3229. $ fmt <"$d_temp"'fmt test formatted nohtml.txt' | convert -size 1000x2000 -font "courier" -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. $ fmt <"$d_temp"'fmt test formatted nohtml.txt' | convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. $ fmt <"$d_temp"'fmt test formatted nohtml.txt' | convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFFFFF" -border 10 "$d_temp"'cover image.png' >> break down the convert $ convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFFFFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. >> so what is the problem? ise an input image $ convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black -annotate +15+30 "$d_temp"'cover image.png' -trim -bordercolor "#FFFFFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. vertical : $ convert -append "$d_temp"'cover image.png' "$d_temp"'cover image.png' -resize 500x "$d_temp"'cover image vertical doubled.png' >> perfect $ convert -append "$d_temp"'cover image.png' "$d_temp"'cnvert text test.png' -resize 500x "$d_temp"'imageVertcalCombine- cover image, short textImage.png' >> perfect echo 'Unix&Linux' | xargs -I '{}' convert -background black -fill green \ -pointsize 84 -font Helvetica label:'{}' test.png $ convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black -annotate +15+30 "$d_temp"'fmt test formatted nohtml.txt' -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. $ convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black -annotate "$d_temp"'fmt test formatted nohtml.txt' +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: invalid argument for option `-annotate': /media/bill/ramdisk/fmt test formatted nohtml.txt @ error/convert.c/ConvertImageCommand/678. $ convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black "$d_temp"'fmt test formatted nohtml.txt' -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: improper image header `/media/bill/ramdisk/fmt test formatted nohtml.txt' @ error/txt.c/ReadTXTImage/450. convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. $ convert -size 1000x2000 -font Helvetica -pointsize 10 -fill black "$d_temp"'fmt test formatted nohtml.txt' -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' https://imagemagick.org/Usage/text/ magick -background lightblue -fill blue -font Candice -pointsize 40 \ -size 320x -gravity Center caption:'ImageMagick Rules OK!' \ caption_centered.gif You can read the text to be drawn from a file, or standard input (from a previous pipeline command), using the '@' filename prefix, just as as we can with "label:". mesgs FilePrivate |\ magick -background lightblue -fill blue -pointsize 12 \ -size 320x caption:@- caption_file.gif [IM Output] $ cat "$d_temp"'fmt test formatted nohtml.txt' | magick -background lightblue -fill blue -font Candice -pointsize 40 -size 320x caption:@- "$d_temp"'cover image.png' Command 'magick' not found, did you mean: command 'magic' from deb magic Try: sudo apt install $ cat "$d_temp"'fmt test formatted nohtml.txt' | convert -background lightblue -fill blue -font Candice -pointsize 40 -size 320x caption:@- "$d_temp"'cover image.png' convert-im6.q16: attempt to perform an operation not allowed by the security policy `@-' @ error/property.c/InterpretImageProperties/3706. convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. OK, so how do I over-ride the security policy? search "Linux convert security policy `@-'" +-----+ https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion ImageMagick security policy 'PDF' blocking conversion Asked 4 years, 9 months ago Modified 27 days ago Viewed 339k times +--+ Works in Ubuntu 20.04 Add this line inside Comment these lines: answered Oct 10, 2020 at 7:49 Ostap Brehin +--+ On Ubuntu 19.04 through 22.04 and probably any later versions with ImageMagick 6, here's how you fix the issue by removing that workaround: Make sure you have Ghostscript ≥9.24: gs --version If yes, just remove this whole following section from /etc/ImageMagick-6/policy.xml: Details: Removing just the line with pattern="PDF" inside would be enough to re-enable PDF conversion. On my computer, I removed the lines for the other PostScript-based filetypes as well just because I can't see a reason to prevent Image Magick from working with such files. (Talking about a personal computer only. On a web server, you might consider it dangerous as PostScript-based files can contain scripts … actually, PostScript is script.) Attribution: @jakob-r's comment on another answer. Plus the helpful comments below ↓ 🙂 edited Jul 22 at 20:34 Madacol answered Dec 5, 2019 at 10:36 tanius +--+ Adding to Stefan Seidel's answer. Well, at least in Ubuntu 20.04.2 LTS or maybe in other versions you can't really edit the policy.xml file directly in a GUI way. Here is a terminal way to edit it. Open the policy.xml file in terminal by entering this command - sudo nano /etc/ImageMagick-6/policy.xml Now, directly edit the file in terminal, find and replace none with read|write as shown in the picture. Then press Ctrl+X to exit. answered Feb 19, 2021 at 6:18 Senthil Vikram Vodapalli +--+ The ImageMagick change was kept after Ghostscript was fixed because applications (especially web applications) often feed arbitrary user-supplied files to ImageMagick, don't always enforce format restrictions properly, and, since Postscript (which PDF uses) is a turing-complete programming language running in a sandbox, there's always the possibility of another hole in the sandbox. It's much better to leave things configured so ImageMagick refuses to process files that require running a program and, instead, just invoke Ghostscript directly when you intentionally want to permit Postscript rendering. That would be accomplished by a Ghostscript command like this: gs -dSAFER -r600 -sDEVICE=pngalpha -o foo.png myfile.pdf Yes, this is a variation on the GhostScript command ImageMagic calls. (see ImageMagick's delegates.xml. -o is shorthand for -dBATCH -dNOPAUSE -sOutputFile=) What's important is that ImageMagick stays locked down, you don't needlessly invoke an intermediate program, and you get more control over the rendering parameters. (eg. -r600 is the DPI to render at and changing -sDEVICE=pngalpha allows you to render directly to your desired format) answered Apr 12, 2021 at 21:58 ssokolow >> Safer to do? : but manual not acceptable!! +-----+ >> Howell : $ gs --version 9.53.3 sudo geany '/etc/ImageMagick-6/policy.xml' >> as per Ostap Brehin above, I added : >> have to reboot machine! #08********08 #] 18Aug2023 search "Linux command line and how do I convert text to image?" convert is part of imageMagic! +-----+ https://unix.stackexchange.com/questions/138804/how-to-transform-a-text-file-into-a-picture How to transform a text file into a picture Asked 9 years, 1 month ago Modified 3 years, 1 month ago Viewed 56k times +--+ ...inital imageMagic ... Preprocessing Input If your text file isn't already formatted the way you need in order to render it (say, if it uses very long lines) then you may have to reformat it before handing it to convert. ImageMagick won't wrap the text, so each line of text will extend its full length horizontally. Fortunately, it's possible to run the file through any command-line formatters you'd like, then pipe the processed text into convert instead of reading directly from the file: fmt < ascii.txt | convert -size 1000x2000 xc:white -font "DejaVu-Sans-Condensed" \ -pointsize 24 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" \ -border 10 +repage image.png That'll render the contents of ascii.txt in 24-point DejaVu Sans Condensed, after it's been processed by the fmt command, which in its default mode of operation will reformat its input by word-wrapping to a width of 75 columns. (Unless there are long continuous strings longer than 75 characters, like URLs, in which case they'll extend over.) Once fmt has reformatted the text, it'll be passed to convert which will then render the piped fmt output, same as if it was reading the file directly. (Specifying a filename of - is a fairly common UNIX shell shorthand for "read from standard input, instead of any named disk file", and ImageMagick's tools follow that convention.) edited Jun 11, 2020 at 12:04 CommunityBot answered Dec 14, 2015 at 19:23 FeRD >> Howell : looks promising! $ echo >"$d_temp"'fmt test.txt' 'p013fig01.09 A sigmoid signal function generates a quenching threshold below which cell activities are treated like noise and suppressed. Activities that are larger than the quenching threshold are contrast enhanced and stored in short-term memory.
|| Quenching threshold xi(o) vs i.
fXi(∞)= xi(∞)/sum[j: xj(∞)]x(∞)
sigmoidtunable filter
stores infinitely many contrast-enhanced patterns
suppresses noise
' >> nyet - still wraps lines? : >> FeRD (Unless there are long continuous strings longer than 75 characters, like URLs, in which case they'll extend over.) >> but I didn't use fmt yet!! man fmt option --width="75" maximum line width (default of 75 columns) >> maybe I have to specify, as default doesn't happen? $ cat "$d_temp"'fmt test.txt' | fmt >"$d_temp"'fmt test formatted.txt' >> OK - seems to work well, doesn't chop words? $ fmt <"$d_temp"'fmt test.txt' | convert -size 1000x2000 xc:white -font "DejaVu-Sans-Condensed" -pointsize 24 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 +repage "$d_ProjMini"'TrNNs_ART/txtImage test.png' >> just produces a small white square? +-----+ not used : "$d_web"'ProjMini/TrNNs_ART/Grossbergs list of [figure, table]s.html' convert-im6.q16: attempt to perform an operation not allowed by the security policy `@-' @ error/property.c/InterpretImageProperties/3706. convert-im6.q16: geometry does not contain image `white' @ warning/attribute.c/GetImageBoundingBox/519. convert-im6.q16: attempt to perform an operation not allowed by the security policy `@-' @ error/property.c/InterpretImageProperties/3706. Command 'not' not found, did you mean: command 'note' from deb note command 'nox' from deb nox command 'nop' from deb graphviz command 'hot' from deb hopenpgp-tools command 'jot' from deb athena-jot command 'nut' from deb nutsqlite command 'net' from deb samba-common-bin command 'nft' from deb nftables command 'dot' from deb graphviz Try: sudo apt install +-----+ $ fmt <"$d_temp"'fmt test.txt' | convert -size 1000x2000 xc:white -font "DejaVu-Sans-Condensed" -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 +repage "$d_temp"'cover image.png' +-----+ convert-im6.q16: attempt to perform an operation not allowed by the security policy `@-' @ error/property.c/InterpretImageProperties/3706. convert-im6.q16: geometry does not contain image `white' @ warning/attribute.c/GetImageBoundingBox/519. convert-im6.q16: attempt to perform an operation not allowed by the security policy `@-' @ error/property.c/InterpretImageProperties/3706. +-----+ man convert -annotate geometry text annotate the image with text $ fmt <"$d_temp"'fmt test.txt' | convert -size 1000x2000 -font "DejaVu-Sans-Condensed" -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 +repage "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. >> getting closer $ fmt <"$d_temp"'fmt test.txt' | convert -font "DejaVu-Sans-Condensed" -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 +repage "$d_temp"'cover image.png' >"$d_temp"'cover image annotated.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. >> maybe it doesn't do .png? man convert -repage geometry size and location of an image canvas $ fmt <"$d_temp"'fmt test.txt' | convert -font "DejaVu-Sans-Condensed" -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' >"$d_temp"'cover image annotated.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. man convert -trim trim image edges -border geometry surround image with a border of color $ fmt <"$d_temp"'fmt test.txt' | convert -font "DejaVu-Sans-Condensed" -pointsize 10 -fill black "$d_temp"'cover image.png' -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image annotated.png' convert-im6.q16: unable to read font `DejaVu-Sans-Condensed' @ warning/annotate.c/RenderType/949. $ fmt <"$d_temp"'fmt test.txt' | convert -pointsize 10 -fill black "$d_temp"'cover image.png' -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image annotated.png' >> command ran, just a small white square output? $ fmt <"$d_temp"'fmt test.txt' | convert -pointsize 10 -fill black "$d_temp"'cover image.png' -annotate +15+30 "$d_temp"'cover image annotated.png' convert-im6.q16: missing an image filename `/media/bill/ramdisk/cover image annotated.png' @ error/convert.c/ConvertImageCommand/3226. $ fmt <"$d_temp"'fmt test.txt' | convert -pointsize 10 -fill black "$d_temp"'cover image.png' "$d_temp"'cover image annotated.png' >> didn't accept command without -annotate +15+30 already fed output of fmt, so delete input file : $ fmt <"$d_temp"'fmt test.txt' | convert -pointsize 10 -fill black -annotate +15+30 "$d_temp"'cover image annotated.png' convert-im6.q16: missing an image filename `/media/bill/ramdisk/cover image annotated.png' @ error/convert.c/ConvertImageCommand/3226. $ fmt <"$d_temp"'fmt test.txt' | convert -size 1000x2000 -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' >"$d_temp"'cover image annotated.png' NUTS!! problem was that $d_temp"'cover image.png' was over-written! $ fmt <"$d_temp"'fmt test formatted.txt' | convert -size 1000x2000 -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' >"$d_temp"'cover image annotated.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. >> back to question, does convert (ImageMagic) handle .png images? search "does convert (ImageMagic) handle .png images?" >> yes $ fmt <"$d_temp"'fmt test formatted.txt' | convert -size 1000x2000 -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. >> same problem $ fmt <"$d_temp"'fmt test formatted.txt' | convert -size 1000x2000 -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' looking again at FeRD's original cmd : $ fmt < ascii.txt | convert -size 1000x2000 xc:white -font "DejaVu-Sans-Condensed" \ -pointsize 24 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" \ -border 10 +repage image.png try : $ fmt <"$d_temp"'fmt test formatted.txt' | convert -size 1000x2000 xc:white -font "courier" -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' +-----+ convert-im6.q16: attempt to perform an operation not allowed by the security policy `@-' @ error/property.c/InterpretImageProperties/3706. convert-im6.q16: geometry does not contain image `white' @ warning/attribute.c/GetImageBoundingBox/519. convert-im6.q16: attempt to perform an operation not allowed by the security policy `@-' @ error/property.c/InterpretImageProperties/3706. +-----+ $ fmt <"$d_temp"'fmt test formatted.txt' | convert -size 1000x2000 -font "courier" -pointsize 10 -fill black -annotate +15+30 "@-" -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. >> perverted the image file again $ fmt <"$d_temp"'fmt test formatted.txt' | convert -size 1000x2000 -font "courier" -pointsize 10 -fill black -annotate +15+30 -trim -bordercolor "#FFF" -border 10 "$d_temp"'cover image.png' convert-im6.q16: no images defined `/media/bill/ramdisk/cover image.png' @ error/convert.c/ConvertImageCommand/3229. #08********08 #] 18Aug2023 search "Linux and how do I catenate images?" can I catenate images vertically - same width as original image, create image from caption combine [Andrew Garcia, Ciro Santilli] (below) : convert image1.png image2.png -append joined_vertical.png horizontal 500px height : convert +append image_1.png image_2.png -resize x500 new_image_conbined.png vertical 500px width : convert -append image_1.png image_2.png -resize 500x new_image_conbined.png >> I have convert +-----+ https://askubuntu.com/questions/226054/how-do-i-join-two-images-together How do I join two images together? Asked 10 years, 8 months ago Modified 6 months ago Viewed 42k times +--+ edited Feb 15 at 7:00 Scarabee answered Mar 5, 2017 at 11:59 user47206 also mentioned convert, ImageMagik, +--+ edited Dec 6, 2012 at 19:09 Bucic answered Dec 6, 2012 at 9:18 Sergey mentioned gim, Pinta +--+ edited Nov 25, 2021 at 18:35 answered Oct 18, 2021 at 10:04 Ciro Santilli Use -resize if the images don't have the same width/height You can fix the height for all of them with the -resize option, e.g. to fix a 500 pixel height on two images joined horizontally: convert +append image_1.png image_2.png -resize x500 new_image_conbined.png Or for vertical joins, you would want to set a fixed width instead: convert -append image_1.png image_2.png -resize 500x new_image_conbined.png Example: image_1.png 1067x600 +--+ Two images side by side: convert image1.png image2.png +append joined_horizontal.png Two images one above the other: convert image1.png image2.png -append joined_vertical.png edited Jun 25, 2022 at 3:40 David answered Jun 24, 2022 at 22:23 Andrew Garcia +-----+ https://stackoverflow.com/questions/20075087/how-to-merge-images-in-command-line How to merge images in command line? [closed] Asked 9 years, 9 months ago Modified 8 months ago Viewed 115k times also mentioned [Image, Grphics]Magik, +--+ If you prefer to merge the pictures from left to right, use the following command: convert image{1..0}.png +append result/result-sprite.png Note the +append instead of -append. edited Jul 21, 2018 at 12:50 answered Jul 21, 2018 at 11:09 abu_bua #08********08 #] 20Jun2023 minimalist image viewers >> USE!! pqiv: "powerful image viewer with minimal UI", AWESOME!!, toggle window border, move window wehen border showing pqiv --hide-info-box --transparent-background +----+ https://opensource.com/article/17/7/4-lightweight-image-viewers-linux-desktop Feh is an old favorite from the days when I computed on older, slower hardware. It's simple, unadorned, and does what it's designed to do very well. +----+ https://www.slant.co/topics/18813/~small-and-lightweight-image-viewers-for-linux What are the best small and lightweight image viewers for Linux? 9 Options Considered 50 User Recs. Apr 28, 2023 Last Updated best: nomacs, qimgv, feh, viewnior, sxiv other: imv, xnview, pqiv, meh >> LMDE Software Manager (LMDE-SM) download : meh: not in LMDE-SM imview: terrible color interpretation XnView MP: too sophisticated, bloated, but good viewer viewnior: great image, simple, fast, still bloated window a bit (menus etc) pqiv: "powerful image viewer with minimal UI", AWESOME!! pqiv --hide-info-box --transparent-background +----+ +----+ +----+ 08********08 #] 13Nov2021 QR code reader - command line version, Python-zbarpygtk $ man zbarpygtk http://www.learningaboutelectronics.com/Articles/How-to-launch-computer-programs-using-Python.php How to Launch Computer Programs Using Python >> Nah - for launching applications, need to know path +-----+ https://askubuntu.com/questions/22871/software-to-read-a-qr-code FOR QR CODE Install the zbarimg command line application by running: sudo apt-get install zbar-tools Use the program, zbarimg provided by the package to read your QR encoded image EXAMPLE from command line: zbarimg "image-file-name.jpg" The above will display what is encoded in the image in the terminal. IF you would like to generate QR code you can install qrencode from the repositories. < input.txt qrencode -s 10 -o test.png The above will encode the information in the input.txt file in an image file called test.png. or you can input text from the console with; qrencode -s 10 -o ubuntu.png http://www.ubuntu.com The above will generate a QR encoded image called ubuntu.png with the url http://www.ubuntu.com encoded in it. WEB APPLICATIONS You can encode and decode online at: online barcodereader.com and at: ZXing Decoder Online FOR DATAMATRIX Install libdmtx-utils from the repository and try using the tools it provides. Libdmtx is a library for reading and writing Data Matrix 2D barcodes, two-dimensional symbols that hold a dense pattern of data with built-in error correction. dmtxwrite - create Data Matrix barcodes. Simple example: mtxwrite -o image.png input.txt This will encode text contained in input.txt in current directory to an image, image.png in current directory. dmtxread - scan Data Matrix barcodes. Simple example: dmtxread image.png That reads the encoded image.png and writes the decoded messages to standard output. See some tips here: http://libdmtx.wikidot.com/helpful-tips Home page: http://libdmtx.sourceforge.net/ Resources: http://libdmtx.sourceforge.net/display.php?text=libdmtx.3 edited Jun 3 '20 at 19:12 Eliah Kagan 110k5151 gold badges301301 silver badges463463 bronze badges answered Jan 23 '11 at 13:41 Sabacon ******** 20Sep2020 for gimp command-line solution with scripts, see : "$d_SysMaint"'images/gimp notes.txt' search "Linux bash - catenate images horizontally or vertically?" As per (2) below - I can't get imageMagic to work (may have had the same problem before?) GraphicsMagick - is tied to imagemagick HOLY COW! - gimp has batch (Linux language)!!!! forget everything else I put scripts in /home/bill/.gimp-2.8/scripts/ : /home/bill/.gimp-2.8/scripts/200920 demo.scm +-----+ https://www.gimp.org/tutorials/Basic_Batch/ GIMP comes with a so-called batch mode that allows you to do image processing from the command line. It also makes it easy to apply the same set of operations to a number of images. We have got a lot of questions on the mailing-lists on how to use the batch mode and this small page tries to explain the basics to you. GIMP can be started with a number of command-line options. Let’s have a closer look at the output of gimp --help In order to do image processing from the command-line, you usually use the Script-Fu batch interpreter. This is the default, which makes things simple. To give you an impression of what can be done, try the interactive console mode: gimp -b - This will tell GIMP to start in batch mode and accept commands on the command-line. This is essentially the same as using the Script-Fu console. It would however be tedious to enter the commands here, so instead we will create a simple script and show you how to run that: A simple example (define (simple-unsharp-mask filename radius amount threshold) (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)) ) (drawable (car (gimp-image-get-active-layer image))) ) (plug-in-unsharp-mask RUN-NONINTERACTIVE image drawable radius amount threshold) (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image) ) ) +-----+ Online tools - https://pinetools.com/merge-images https://www.bleepingtech.com/stitch-two-images/ https://www.filesmerge.com/merge-jpg https://www.aconvert.com/image/merge/ https://sourcedigit.com/6531-3-excellent-online-tools-join-multiple-images-single-image/ 3 Excellent Online Tools to Join Multiple Images Into a Single Image By Sourabh / May 8, 2015 Photo Joiner (http://www.photojoiner.net/) Fotor (http://www.fotor.com/) Quick Picture Tools (http://www.quickpicturetools.com/) +-----+ LMDE Software manager : scrot command line screen capture not many options! must manually set area of screen? stupid! $ scrot -s >>'/media/bill/PROJECTS/System_maintenance/images/scrot test mouse-defined.png' OPTIONS -h, --help, display help output and exit. -v, --version, output version information and exit. -b, --border, When selecting a window, grab wm border too -c, --count, Display a countdown when used with delay. -d, --delay NUM, Wait NUM seconds before taking a shot. -e, --exec APP, Exec APP on the saved image. -q, --quality NUM, Image quality (1-100) high value means high size, low compression. Default: 75. (Effect differs depending on file format chosen). -m, --multidisp, For multiple heads, grab shot from each and join them together. -s, --select, Interactively select a window or rectangle with the mouse. -u, --focused, Use the currently focused window. -t, --thumb NUM, generate thumbnail too. NUM is the percentage of the original size for the thumbnail to be. -z, --silent, prevent beeping. $ scrot -h Example: scrot '%Y-%m-%d_$wx$h_scrot.png' -e 'mv $f ~/images/shots/' Creates a file called something like 2000-10-30_2560x1024_scrot.png and moves it to your images directory. $ scrot '%Y-%m-%d_$wx$h_scrot.png' +-----+ https://stackoverflow.com/questions/61356657/to-concatenate-4-images-using-np-concatenate-two-vertically-and-two-horizontall Note you can do the same thing just using a couple of lines of bash shell script if you use ImageMagick: #!/bin/bash # Build list of images images=(*.jpg) out=1 # Keep going till there are fewer than 4 left in list while [ ${#images[@]} -gt 3 ] ; do # Montage first 4 images from list magick montage -geometry +0+0 -tile 2x2 -background yellow "${images[@]:0:4}" "montage-${out}.png" # Delete first 4 images from list images=(${images[@]:4}) ((out+=1)) done edited Apr 22 at 11:19 answered Apr 22 at 10:14 Mark Setchell +-----+ I have already used imageMagic & it is installed on LMDE!!! totally forgot $ magick montage -geometry +0+0 -tile 2x2 -background yellow "${images[@]:0:4}" "montage-${out}.png" >> no command? "imagemagick" doesn't work Try $ d_SP500='/media/bill/SWAPPER/Website - raw/economics, markets/SP500/' $ cat "$d_SP500""1872-2020 SP500 index using TradingView & 2 times yahoo finance.png" "$d_SP500""1872-2020 SP500 index using TradingView & 2 times yahoo finance.png" >"$d_SP500""1872-2020 SP500 catenated.png" $ cat "$d_SP500""1872-2020 SP500 index using TradingView & 2 times yahoo finance.png" "$d_SP500""1872-2020 SP500 index using TradingView & yahoo finance.png" >"$d_SP500""1872-2020 SP500 catenated 2 different.png" >> Nope - cat just doubles file size and overwrites? (only one of two images shows) (2) Can't find command, can't find an icon, can't even re-download! Maybe this is a hint... +-----+ https://stackoverflow.com/questions/20075087/how-to-merge-images-in-command-line You can also use GraphicsMagick, a lighter and faster fork of ImageMagick: gm convert image1.png image2.png -append combined.png A simple time comparison of merging 12 images: time convert image{1..12}.jpg -append test.jpg real 0m3.178s user 0m3.850s sys 0m0.376s time gm convert image{1..12}.jpg -append test.jpg real 0m1.912s user 0m2.198s sys 0m0.766s GraphicsMagick is almost twice as fast as ImageMagick. answered Aug 22 '15 at 9:46 tjanez # enddoc