Skip to content

Instantly share code, notes, and snippets.

@liscio
Created March 12, 2015 18:33
Show Gist options
  • Select an option

  • Save liscio/f64a2ec3c47b17418b22 to your computer and use it in GitHub Desktop.

Select an option

Save liscio/f64a2ec3c47b17418b22 to your computer and use it in GitHub Desktop.

Revisions

  1. liscio created this gist Mar 12, 2015.
    16 changes: 16 additions & 0 deletions retinaify.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/bin/sh

    # First, set the width/height DPI on the file
    sips -s dpiWidth 144 -s dpiHeight 144 "$1"

    # Fake that it is a screen capture (wat?)
    xattr -wx com.apple.metadata:kMDItemIsScreenCapture "62 70 6C 69 73 74 30 30 09 08 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09" "$1"
    xattr -wx com.apple.metadata:kMDItemScreenCaptureType "62 70 6C 69 73 74 30 30 59 73 65 6C 65 63 74 69 6F 6E 08 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12" "$1"
    xattr -wx com.apple.FinderInfo "00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" "$1"

    # Force spotlight to re-index the file to see the DPI change, etc.
    mdimport "$1"

    # Now, open it in preview
    open "$1"