Why is my Applescript adding a background image to the .dmg folder, getting the size wrong?

I use the following Applescript to configure .dmg folder options, icon spacing, etc:

on run argv tell application "Finder" set diskname to item 1 of argv tell disk diskname open set current view of container window to icon view set toolbar visible of container window to false set statusbar visible of container window to false set bounds of container window to {400, 100, 900, 699} set theViewOptions to the icon view options of container window set arrangement of theViewOptions to not arranged set icon size of theViewOptions to 100 set background picture of theViewOptions to file "background.png" set file_list to every file repeat with i in file_list if the name of i is "Applications" then set the position of i to {368, 135} else if the name of i ends with ".app" then set the position of i to {134, 135} end if -- Change the 7 to change the color: 0 is no label, then red, -- orange, yellow, green, blue, purple, or gray. set the label index of i to 7 end repeat update without registering applications delay 4 end tell end tell end run 

A properly configured window, with one exception: the image 500x600 background.png is reduced to about a third of its original size and placed in the upper left corner. I can not explain why this is happening. Any suggestions?

+4
source share
1 answer

Boy, this is really st00pid.

I ran into this problem on OS X Lion. It turns out that Leo requires that the background image for the folder be set to 72 DPI. The image I used was 200 DPI, so Lion reduced it to the actual pixels.

I re-saved the image with the declared resolution of 72 DPI and it works fine.

+5
source

Source: https://habr.com/ru/post/1380427/


All Articles