The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
png files that are cut and pasted into omnigraffle are the wrong size Thread Tools Search this Thread Display Modes
hi all,

i have been using omnigraffle for many years and recently started seeing a change in the way png pasting works.

i am in iOS developer and use omnigraffle to generate artwork for the apps that build. my workflow looks like this:
  1. i get two pngs from a client - one retina and one non-retina
  2. in the finder i select the files and copy them to the clipboard
  3. in omnigraffle, i paste them to my design document

what used to happen is that the pasted images would have two different sizes; the retina image would have dimensions at 2x the non-retina image.

now when i paste the images, they have the same dimensions both visually and in the size inspector.

i have attached an examples of my experience.

did something change in omnigraffle? is there a setting that controls this?

thanks,

jjm
Attached Thumbnails
Click image for larger version

Name:	current-experience.png
Views:	248
Size:	163.4 KB
ID:	2417   Click image for larger version

Name:	previous-experience.png
Views:	254
Size:	129.5 KB
ID:	2418  
 
Might be worth looking at the 'natural size' vs 'stretch to fill' option in the image inspector.
 
You could also experiment with running a script like this to place images
(and optionally scale them, if you adjust the value of the prScale property near the top).

Code:
property pTitle : "Place several images     Ver 0.8" -- IN OMNIGRAFFLE
property plngAcross : 4 -- number of thumbnails to place in a row
property prScale : 1 -- thumbnail size as a proportion of full size
property pblnShadow : false


--	Ver 0.6	Compatible with Launchbar's 'Instant Send' function
--				Select some files in the Finder, 
--				activate 'Send to' with a double-tap, 
--					Launchbar Preferences > Shortcuts > Modifier taps > Instant send
--				and select the script with its assigned abbreviation.


on run
	-- CHOOSE SOME IMAGES (SELECTING SEVERAL IMAGES FROM THE FILE DIALOG)
	tell application id "sevs"
		activate
		set lstFiles to (choose file with prompt "Place one or more images" with multiple selections allowed)
	end tell
	
	PlaceFiles(lstFiles)
end run

on open (lstFiles)
	PlaceFiles(lstFiles)
end open

on PlaceFiles(lstFiles)
	-- PLACE ALL THE SELECTED IMAGES IN A NEW DOCUMENT
	tell application id "OGfl"
		activate
		tell front canvas of (make new document with properties {automatic layout:false})
			set {rOriginX, rOriginY} to {0, 0}
			set lngMaxHeight to 0
			
			set i to 0
			set my text item delimiters to "/"
			repeat with oFile in lstFiles
				try
					-- GET THE DIMENSIONS OF THE IMAGE
					set strFile to POSIX path of oFile
					-- Image events
					tell application id "imev"
						tell (open file strFile)
							set {rX, rY} to dimensions
							close saving no
						end tell
					end tell
					
					-- SCALE DOWN TO THUMBNAIL
					set {lngWidth, lngHeight} to {rX * prScale, rY * prScale}
					
					-- AT THE END OF THE ROW RETURN TO LEFT HAND PAGE, AND MOVE DOWN A ROW
					if i ≥ plngAcross then
						set rOriginX to 0
						set rOriginY to rOriginY + lngMaxHeight
						set lngMaxHeight to 0
						set i to 0
					else
						-- RECORD THE MAXIMUM DEPTH IN THE CURRENT ROW OF THUMBNAILS
						if lngHeight > lngMaxHeight then set lngMaxHeight to lngHeight
					end if
					
					-- CREATE A THUMBNAIL with [folder/filename] of source image in url
					set strPathEnd to (items -2 thru -1 of (text items of strFile)) as string
					--make new shape with properties {origin:{rOriginX, rOriginY}, size:{lngWidth, lngHeight}, draws stroke:false, fill:no fill, draws shadow:pblnShadow, image:strFile, url:strPathEnd}
					make new shape with properties {origin:{rOriginX, rOriginY}, size:{lngWidth, lngHeight}, draws stroke:false, fill:no fill, draws shadow:pblnShadow, image:strFile, url:strFile}
					
					-- AND INCREMENT THE HORIZONTAL POSITION
					set rOriginX to rOriginX + lngWidth
					set i to i + 1
				on error
					display alert strFile & " does not appear to be a graphic file ..."
				end try
			end repeat
			set my text item delimiters to space
		end tell
	end tell
	
end PlaceFiles
 
This is actually something that's going on at the OS level in order to support HiDPI mode in Mac OS X 10.7 and later. From the Developer Documentation:

"When it loads an image, an NSImage object automatically sets the size and scale properties to appropriate values based on the suffix of the image file. For standard resolution images, it sets the scale property to 1.0 and sets the size of the image to the image’s pixel dimensions. For images with the @2x suffix in the filename, it sets the scale property to 2.0 and halves the width and height values to compensate for the scale factor. These halved values correlate correctly to the point-based dimensions you need to use in the logical coordinate space to render the image."

We've put in a fix to handle this more reasonably in OmniGraffle 5.4, until we can figure out whether or not we want to support the @2x suffix conventions, and where. Amusingly enough, NSImage supports @4x, @5x, etc. as well.
__________________
"Vroom! Vroom!!"
 
thanks Joel. i believe i understand the problem now. i think i started seeing this behavior after up updated to 10.7.4. is that possible?

i just tried in the latest 5.4 rc and the paste operation works as before (as expected).

i am glad i asked. i thought that i had inadvertently changed some setting - possibly through an arcane key-stroke.

hurray for omnigraffle!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Illustrator CS6 objects are transparent when pasted in Omnigraffle peterlockhart OmniGraffle General 5 2013-02-08 05:11 PM
Cannot find backup files after wrong way sync quellefromage OmniFocus Syncing 1 2012-07-03 02:38 PM
Size of files Web interface exceeds 4 GB jerryzurek OmniFocus 1 for Mac 1 2009-11-24 11:02 AM
5.10 SP: window size set wrong hhm OmniWeb Bug Reports 1 2009-04-23 08:36 AM
Page size wrong intmarine OmniGraffle General 1 2008-09-13 12:50 PM


All times are GMT -8. The time now is 08:23 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.