I have some Photoshop actions that re-size an image different sizes for different purposes. The files are always a particular height and width when completed, like 475 x 440 or 50 x 50, etc…I have 6 sizes all together.
Would it be even possible to have an AS go into that folder and find for example any image that is 50 x 50 and rename it using a certain convention, like the first 8 digits of its existing name_s_1.jpg. For the 475 x 440 ones, it would be named the first 8 digits of its existing name_d_1.jpg…etc…
Sure it’s possible. But you have to use something to read each image’s width and height. You could use Photoshop to open each image, or ImageEvents (scriptable process that doesn’t have a front-end), or a unix process/shell script (look up SIPS). There are a couple options. The Finder won’t do it, System Events won’t do it.
If I were doing it, I’d write a script that controls Photoshop to do my file-sizing AND saves/names each size to your convention at the same time. Photoshop is pretty scriptable these days (I remember back in PS6 it was almost nothing except “do action…”).
Chris
Thanks… Unfortunately all the Photoshop actions have already been made, and I am not at liberty to alter them. Just freelancing here and trying to make my life easier by not having to go in and rename each one manually once its done. That is why I was hoping an AS could read the metadata in the file, without actually opening it in PS, and rename it based on that size criteria, but I can see what you are saying about it needing to open in Photoshop in order to get the size…
OK…I;ll keep plugging at it!!! Thanks for giving me some direction here!
babs
This piece of code give an easy access to the picture size.
set source_file to choose file of type {"public.jpeg"}
tell application "Image Events"
--launch -- always use with Folder Actions
set this_image to open file (source_file as string)
set {oldW, oldH} to dimensions of this_image
close this_image
end tell
activate me
display dialog "width = " & oldW & " points" & return & "height = " & oldH & " points"
Yvan KOENIG (VALLAURIS, France) jeudi 1 janvier 2011 18:08:53
Oh that’s very interesting? I’m thinking about rather than Display dialog, having AS capture that info (on the clipboard maybe?) and do a complete If/Else Scenario?
something like If oldH = 440, then rename it first 8 digits of the file name_d_1.jpg
else … it moves to the next option…if oldH = 50, then rename if the first 8 digits of the file name_s_1.jpg
set source_file to choose file of type {"public.jpeg"}
set dimensions to paragraphs -2 thru -1 of (do shell script "sips -g pixelHeight -g pixelWidth " & quoted form of POSIX path of source_file & " | awk '/pixel/ {print $NF}'")
@ Mark-I do have Bridge, but when I thought about a batch rename, I didn’t see anyway to isolate certain size images in a folder, nor how would I tell it, based on the criteria choices to only use the first 8 digits of the name before adding on the rest of the criteria. But if you have any ideas I am all ears
@Stefan…hi…long time since I have been on here…hope all is well!!!
Thanks for this info…Can I use this answer showing up in the result box as a way to start thinking about the IF/Then scenario I mentioned earlier in this post?
Barbara, in Bridge you can set up to 4 extra lines of info to be visible (usually only file name) see the app pref’s for the choices available. Now you can set and see the pixel dimensions in the GUI. Then choose to sort window by dimensions. This should give you groups of same sized images you can easily select. Either drag each bundle out and rename with something else ( script ) you may be able to rename with Bridge but you will need to use the string and regexp options.