Problems with KM Image Tools & Retina Screens

###Problems with KM Image Tools & Retina Screens

Perhaps I'm doing something wrong, but it appears to me that there may be a bug in the image handling of some of the KM Image Actions/Functions, like the Draw Shape onto Image action (KM Wiki):

###Issue

  • When the Draw Shape Action is executed, it doubles the image size on a Mac that has a Retina monitor, even if it is taken from a standard 72 DPI monitor.

###Environment

  • Keyboard Maestro 7.3.1 (7.3.1) on macOS 10.11.6
  • iMac-27 (Late 2015) with 5K Retina Monitor
    • At 5120 x 2880 native resolution: 218 PPI
  • Second monitor of ASUS-27 PB278Q High-res Monitor
    • At 2560 x 1440 native resolution: 109 PPI
  • Both monitors set to a custom resolution of 2048 x 1152
    • I don't know how this affects PPI, but if it is scaled, then:
      • iMac-27: 87 PPI
      • ASUS-27: 87 PPI

I know very little about images, so please feel free to correct me anywhere I have misstated something.

###How KM Sees Images on Clipboard
Using the Get Image Size action (KM Wiki) Action:

  • iMac-27: 144 DPI
  • ASUS-27: 72 DPI

###Examples:
####Image on ASUS-27, captured using std macOS shortcut:

####Same image on clipboard, but applied KM Draw Border Action:
(using the below macro, but with the last action, Resize Image, disabled)


So, you can clearly see that the image AFTER adding a border via KM is much larger, twice the size I believe.

The last Action in the below Macro tries to fix this, and it does reduce the size. Unfortunately, it also slightly distorts the image. However, the image distortion may have come from the Draw Shape Action.

###Can anyone confirm this?
If I'm doing something wrong, please advise how to correct.


###MACRO:   KM Draw Border on Clipboard Image @TEST

~~~ VER: 1.0    2017-04-21 ~~~

####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/5/57dbf88419c8903f968fe48ee304a4e20a747aa7.kmmacros">KM Draw Border on Clipboard Image @TEST.kmmacros</a> (14 KB)
**NOTICE:  Macro was uploaded in a DISABLED state.**

---

###ReleaseNotes

This macro is just for _testing_.

---

<img src="/uploads/default/original/2X/6/6b2cba396bbef3f141191bb90599db37cc7259da.png" width="684" height="1291">

Fixed for the next version.

Keyboard Maestro does not preserve the DPI of images, generally the resulting DPI will always be 72.

Keyboard Maestro is based on pixels, and so when working correctly the before and after image should have the same pixel size for an operation like this, though the DPI might change (probably will unless it starts as 72).

I may attempt to preserve DPIs in the future.

1 Like

Hey @peternlewis ,

Is this still on your radar?

-Chris

Yes. The actions are fixed so the pixel size no longer changes. Preserving the DPI is still on the todo list.

1 Like

Done for the next version.

3 Likes