Downscale for screenshot images on Mac Retina

On Mac OS, to capture the screen, we can use the shortcut keys Cmd+Shift+3/4, however, on Mac Retina, the screenshot image will be doubled its resolution level and file size in comparison with the default standard.

If you are working on a personal blog or only need the screenshot image to share yours to others, you may feel it a bit inconvenient.

To resolve this problem, in this article, we will share to you 02 solutions as follows:

Solution 1: Take a normal screenshot and create a shortcut menu to make a smaller image file if necessary.

  1. Open apps Automator (in Application)
  2. Choose to create Service
  3. Choose Run Applescript for this action.
  4. Modify Service receives selected image files in Finder.app as the below picture

Then, copy the following code as instructed in the above picture.

on run {input}
	set theInput to item 1 of input
	set filePath to POSIX path of theInput
	tell application "Finder"
		set pathLength to (length of filePath)
		set pos to pathLength
		#find last offset of "."
		repeat
			if (text (pos) thru pos of filePath) is not equal to "." then
				set pos to pos - 1
			else
				exit repeat
			end if
		end repeat
		# append suffix to file name
		set suffix to "@1x"
		set newFile to text 1 thru (pos - 1) of filePath & suffix & text pos thru pathLength of filePath
	end tell
	
	tell application "Image Events"
		set theImage to open filePath
		scale theImage by factor 0.5
		save theImage in newFile
		close theImage
	end tell
end run

After that choose menu File -> Save -> then insert Resize for non-retina

Now, go to Finder when right-clicking the mouse into a image file, you will have the menu as showed in the below picture to decrease the file size to as a half of the original image.

Solution 2: Save both 2 versions @1x và @2x anytime when capturing the screen by shortcuts Cmd+Shift+4

By this way, we will create a service similar to Cmd+Shift+4 to capture the screen, and then create shortcut for replacing the default Cmd+Shift+4. After taking the picture it will create both02 version 1x and @2x.

Note: When you apply this solution, the menu cannot be captured by right-clicking as default in Mac OS

With this solution, you also create a Service by Automator similar to the above instruction with Run AppleScript and then copy and paste the following code:

  • In savePath “/Users/ptcong/Desktop“, change ptcong into your user account
  • In fileType “png” is a file format, you can change into jpg or gif if needed
  • In fileNameScreenShot” is the picture ‘s name after captured.
  • In keepRetinaScreenShot NO” you can change to YES to keep the original; file size and resolution of the screenshot in Retina display.

 

# the script written by ptcong90
on run {input}
	set savePath to "/Users/ptcong/Desktop"
	set fileType to "png"
	set fileName to "Screen Shot"
	set keepRetinaScreenShot to "NO"
	
	set fileName to fileName & " " & get_time()
	set fileName1X to savePath & "/" & fileName & "@1x." & fileType
	set fileName2X to savePath & "/" & fileName & "@2x." & fileType
	
        try	
                do shell script "screencapture -i -r -t " & fileType & " \"" & fileName2X & "\""
         end try	
	tell application "System Events"
		if exists file fileName2X then
			tell application "Image Events"
				set theImage to open fileName2X
				scale theImage by factor 0.5
				save theImage in fileName1X
				close theImage
			end tell
			if keepRetinaScreenShot is not equal to "YES" then
				do shell script "rm \"" & fileName2X & "\""
			end if
		end if
	end tell
end run

on get_time()
	set now to current date
	set sHours to hours of now
	if sHours is greater than 12 then
		set sHours to sHours - 12
	end if
	set sTime to time string of now
	return (year of now) & "-" & zero_pad(month of now as number, 2) & "-" & zero_pad(day of now as number, 2) & " at " & sHours & "." & zero_pad(minutes of now, 2) & "." & zero_pad(seconds of now, 2) & " " & text ((length of sTime) - 1) thru length of sTime
end get_time

on zero_pad(value, sLength)
	set sResult to value
	set repeatTimes to sLength - (length of (value as string))
	if repeatTimes is greater than 0 then
		repeat repeatTimes times
			set sResult to "0" & sResult as string
		end repeat
	end if
	return sResult
end zero_pad

We will have the following picture:

After that choose menu File -> Save -> insert Make screenshot.

Then you create 1 shortcut to run this application.

System Preferences -> Keyboard -> Shortcut -> Services -> pull down for General

In Make screenshot tab, you add shortcut (Cmd+Shift+5) as the below picture:

Now when you hold the shortcuts Cmd+Shift+5, you will see that it is familiar to the solution for capturing screen of Mac OS.

Good luck!


Warning: touch(): Utime failed: Operation not permitted in /home/nginx/domains/freesoftwaredl.info/public/blog/wp-content/themes/newsplus/single.php on line 440