Set the screen shot feature at low def

How are one supposed to do to set the Mac's screen shot feature at low def or at least being able to set ourself the quality please ?

Posted on Jan 25, 2019 5:16 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 25, 2019 5:46 PM

I post process my screenshots using /usr/bin/sips, but it is a bit ugly


I created an Automator app using "Take Screenshot", then pass control to a bit of shell script that converts the image to a 72 pixels/inch. It could be be converted to any pixel/inch density you desire, just modify the shell script's DPI variable.


This first part is from the Automator app, the second part is the complete shell script in the 2nd Automator box.




This is the part that goes into the "Run Shell Script" section.


# Rescale image(s) to 72 dpi (dots/inch; aka pixels/inch)
# The pixel width and height is also scaled, so that the image should appear
# to be the same size when displayed, but just have less resolution.
DPI=72

in="${HOME}/Desktop/72dpi_Snapshot.png"
n=0
while /usr/bin/true
do
    n=$((n+1))
    out="$(/usr/bin/dirname "${in}")/$(/usr/bin/basename "${in%.png}")_${n}.png"
    [[ ! -e "${out}" ]] && break
done

#/Users/raharris/tmp.png
#  pixelWidth: 512
#  pixelHeight: 512
#  typeIdentifier: public.png
#  format: png
#  formatOptions: default
#  dpiWidth: 96.000
#  dpiHeight: 96.000
#  samplesPerPixel: 4
#  bitsPerSample: 8
#  hasAlpha: yes
#  space: RGB
#  profile: sRGB IEC61966-2.1

while read line
do
    set -- ${line}
    [[ "$1" = pixelWidth:  ]] && wpix=$2
    [[ "$1" = pixelHeight: ]] && hpix=$2
    [[ "$1" = dpiWidth:    ]] && wdpi=$2
    [[ "$1" = dpiHeight:   ]] && hdpi=$2
done < <(/usr/bin/sips -g all "${in}" 2>&1)

wpix=${wpix%%.*}
hpix=${hpix%%.*}
wdpi=${wdpi%%.*}
hdpi=${hdpi%%.*}
w=$(( (wpix * DPI) / wdpi ))
h=$(( (hpix * DPI) / hdpi ))

/usr/bin/sips -s dpiHeight $DPI -s dpiWidth $DPI -z $h $w "${in}"




15 replies
Question marked as Top-ranking reply

Jan 25, 2019 5:46 PM in response to skanner21

I post process my screenshots using /usr/bin/sips, but it is a bit ugly


I created an Automator app using "Take Screenshot", then pass control to a bit of shell script that converts the image to a 72 pixels/inch. It could be be converted to any pixel/inch density you desire, just modify the shell script's DPI variable.


This first part is from the Automator app, the second part is the complete shell script in the 2nd Automator box.




This is the part that goes into the "Run Shell Script" section.


# Rescale image(s) to 72 dpi (dots/inch; aka pixels/inch)
# The pixel width and height is also scaled, so that the image should appear
# to be the same size when displayed, but just have less resolution.
DPI=72

in="${HOME}/Desktop/72dpi_Snapshot.png"
n=0
while /usr/bin/true
do
    n=$((n+1))
    out="$(/usr/bin/dirname "${in}")/$(/usr/bin/basename "${in%.png}")_${n}.png"
    [[ ! -e "${out}" ]] && break
done

#/Users/raharris/tmp.png
#  pixelWidth: 512
#  pixelHeight: 512
#  typeIdentifier: public.png
#  format: png
#  formatOptions: default
#  dpiWidth: 96.000
#  dpiHeight: 96.000
#  samplesPerPixel: 4
#  bitsPerSample: 8
#  hasAlpha: yes
#  space: RGB
#  profile: sRGB IEC61966-2.1

while read line
do
    set -- ${line}
    [[ "$1" = pixelWidth:  ]] && wpix=$2
    [[ "$1" = pixelHeight: ]] && hpix=$2
    [[ "$1" = dpiWidth:    ]] && wdpi=$2
    [[ "$1" = dpiHeight:   ]] && hdpi=$2
done < <(/usr/bin/sips -g all "${in}" 2>&1)

wpix=${wpix%%.*}
hpix=${hpix%%.*}
wdpi=${wdpi%%.*}
hdpi=${hdpi%%.*}
w=$(( (wpix * DPI) / wdpi ))
h=$(( (hpix * DPI) / hdpi ))

/usr/bin/sips -s dpiHeight $DPI -s dpiWidth $DPI -z $h $w "${in}"




Feb 8, 2019 6:22 PM in response to skanner21

In my above Automator example above all the sips action happens in a double-clickable app.


That is to say, you double-click on the app created by Automator, it prompts you to choose what you want to select, then it post-processes the screenshot via sips, all within the Automator app you create.


If you want to manually run sips from a Terminal session that is perfectly OK. I write my Automator based app to avoid manually running sips at the command prompt in a Terminal session.


The "man sips" command gives you instructions on how to use sips.

Feb 8, 2019 5:22 AM in response to skanner21

Where can i find "/usr/bin/sips," please ?

/usr/bin/sips is an Applications -> Utilities -> Terminal command. Use the command:

man sips

to find out more information about the sips command


It is not a GUI based app.


But to find it from the Finder you could use:

Finder -> Go -> Go to folder -> /usr/bin


I have checked, and it exists on systems as far back as Snow Leopard 10.6.8. If you have something older, I do not know if it exists or not, as I do not have access to any systems older than Snow Leopard.

Feb 9, 2019 11:27 AM in response to BobHarris

Bob,


Wrote this a couple of weeks back:


#!/usr/bin/python
# coding: utf-8

# show the screen size w x h and the effective resolution in ppi

from AppKit import NSScreen
from Quartz import CGDisplayScreenSize
import math
import sys


def main():
    # 1.0 unless retina which is 2.0
    scr_factor = NSScreen.mainScreen().backingScaleFactor()
    scr_desc = NSScreen.mainScreen().deviceDescription()
    displayPixelSize = scr_desc['NSDeviceSize'].sizeValue()
    displayPhySize = CGDisplayScreenSize(scr_desc['NSScreenNumber'].
                                         unsignedIntValue())
    ppi = (displayPixelSize.width / displayPhySize.width) * 25.4
    print("Display Size: {0:g}x{1:g}".format(displayPixelSize.width,
                                             displayPixelSize.height))

    # round up to nearest ten
    ppi = (math.ceil(ppi / 10.0) * 10.0) * scr_factor
    print("Effective Res. (ppi): {0:g}".format(ppi))


if __name__ == '__main__':
    sys.exit(main())


And on a non-retina Mac:

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Set the screen shot feature at low def

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.