Skip to content

Instantly share code, notes, and snippets.

@atomicules
Created March 24, 2011 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomicules/884911 to your computer and use it in GitHub Desktop.
Save atomicules/884911 to your computer and use it in GitHub Desktop.
View Images Actual Size - Applescript for GraphicConverter. Note that this information is probably out of date. It is being added here for reference/archival purposes and relates to a blog post from 2006
-- View Image Actual Size
-- ======================
-- DESCRIPTION
-- ===========
-- This script zooms an image in GraphicConvertor so that it is shown actual size. By this I mean if you measure in on screen with a ruler it should match the size it prints at when printed at Original size.
-- I wrote this to match the way Gimp works since you can specify a Screen Resolution to use. OSX, etc assumes a screen resolution of 72 ppi when viewing images at Actual/Original size. More often than not this isn't the case. For instance on my 12" powerbook the screen is 9.68" x 7.26". At a resolution of 1024x768 pixels this gives: 1024 / 9.68 = 105.8 ppi
-- It can only zoom at whole numbers, so may in fact be slightly off actual printed size, but far far less than the assumed 72dpi on screen.
-- HOW TO USE
-- ==========
-- Edit this script to suit your screen resolution (you will have to physically measure your screen to do this). Edit the property Screenres at the start of the script
-- You then need to open an image and set the resolution as desired. I.e. a lot of scanned images will come in as 72dpi, but you want to print at 300 dpi. Set this and save the image. The script calls on the imageinfo in the saved file it can not read any unsaved changes made since opening
-- INSTALLATION
-- ============
-- Place in ~/Library/Scripts to run from the OSX script menu or ~/Library/Application Support/GraphicConvertor/Scripts to run from within GraphicConverter.
-- Uses UI element scripting. You must enable access for assistive devices
-- HISTORY
-- =======
-- v1 06-Jan-2006
-- TO DO
-- =====
-- Nothing planned
-- CONTACT
-- =======
-- email: i5m.eats.apples@i5m.me.uk
-- web: www.i5m.me.uk
property screenres : 105.8
tell application "GraphicConverter"
set fileref to ""
set fileref to file of window 1
get file imageinfo fileref
set picinfo to {}
set picinfo to (get file imageinfo fileref)
set picres to item 3 of picinfo as number
set zoomfactor to round (100 * (screenres / picres)) rounding to nearest
set zoomfactor to zoomfactor as string
end tell
tell application "System Events"
if UI elements enabled then
tell process "GraphicConverter"
set frontmost to true
end tell
click menu item "View as Proportional…" of menu "Zoom" of menu item "Zoom" of menu "Picture" of menu bar 1 of process "GraphicConverter"
keystroke zoomfactor
delay 1
keystroke return
--alternative way of ok-ing this dialog is below
--click button "OK" of window "Change Proportional Size" of process "GraphicConverter"
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment