Help Deciding on a Language for a Macro
Author |
Message |
DtY
|
Posted: Wed Jul 01, 2009 9:03 pm Post subject: Help Deciding on a Language for a Macro |
|
|
I need to add a perspective shadow to more than a thousand images. I'm doing this for a freelance job I picked up online, and need to do at least 200 per day (for five days/week, if I do them on the weekend, it can add to batches throughout the week, so time isn't a huge factor, but I would like to finish ASAP). I have decided to do it in either Python or PHP, but not sure which to choose.
I know I will be able to write the script in either language in more than enough time with either.
PHP
Pros: Have more knowledge for working with images (through GD)
Cons: Slower (But not sure how significant the difference is)
Python
Pros: Faster, Overall better language for non-web stuff (imo)
Cons: Limited knowledge of working with images, has been years since I had a need to process images with python, and can't remember any of it. (On the other hand, I imagine the interface to GD is at least similar to PHP, and I am sure I can learn enough to get by and have the script in less time than I have).
Because I know more about image processing in PHP, I would be able to write the script faster, and have it started sooner, but it would run slower (I imagine).
Also, I'm not sure if I should use a bash loop to make the script do one at a time, or use a loop within the program, thoughts on this one?
[edit] Apparently macro might not be the word I'm looking for. Is that the right word for a program that does the same thing over and over? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
OneOffDriveByPoster
|
Posted: Thu Jul 02, 2009 8:32 pm Post subject: Re: Help Deciding on a Language for a Macro |
|
|
bash loop: if your processing take long, why not? saves you from having memory leaks between images or variables initialized correctly only for the first loop.
otherwise: the process fork/exec overhead can be a bit nasty. |
|
|
|
|
|
DtY
|
Posted: Thu Jul 02, 2009 9:28 pm Post subject: RE:Help Deciding on a Language for a Macro |
|
|
Oh yeah, update;
I was working on it in PHP, and eventually gave up due to transparency not working no matter what I did. So, I went to Python/PIL, looked into that, hated it. Then I got an idea, why don't I see if ImageMagick CLI can do this?
http://www.imagemagick.org/Usage/distorts/#shadow3d
Coolest thing ever. Just need to figure out how to tweak some settings, and that should be enough |
|
|
|
|
|
Insectoid
|
Posted: Fri Jul 03, 2009 11:37 am Post subject: RE:Help Deciding on a Language for a Macro |
|
|
Perspective shadows.....Cool. Is this like, adding shadows to where shadows would be on a 2-d image? Interesting indeed. Could you explain how one would do this? (or the real definition of 'perspective shadow' in case I was wrong) |
|
|
|
|
|
DtY
|
Posted: Fri Jul 03, 2009 1:02 pm Post subject: RE:Help Deciding on a Language for a Macro |
|
|
Yup, a perspective shadow is like a shadow from a light source on a 2D object. (Or even 3D object). Like, shadows in the real world. (There's also drop shadows where the shadow is underneath, off to the side, like the light is almost directly above, but a bit off to the side).
The example in the text is:
->
[edit] If you have the gimp, the method to creating one is to start with an image on a transparent background, create a new layer, select by alpha on original layer, fill black on new layer, unselect all, Gaussian blur, turn down opacity to about 50%, image|layer|autocrop layer, perspective tool drag out top corners to where you want the perspective to be, and drop layer below the original.
You might need to increase the canvas size first, so you don't run out of room. |
|
|
|
|
|
Insectoid
|
Posted: Fri Jul 03, 2009 1:32 pm Post subject: RE:Help Deciding on a Language for a Macro |
|
|
How would you automate this though? Or is your script going to run with manual input? |
|
|
|
|
|
TheGuardian001
|
Posted: Fri Jul 03, 2009 1:46 pm Post subject: Re: Help Deciding on a Language for a Macro |
|
|
alternatively, if you have the Gimp, filters -> light and shadow -> perspective.
And I'm also curious as to how you would automate this. Not many image editing programs allow for mass automated edits(actually, none that I know of), and I doubt that you'd want to write your own program to do the actual editing. |
|
|
|
|
|
DtY
|
Posted: Fri Jul 03, 2009 2:12 pm Post subject: RE:Help Deciding on a Language for a Macro |
|
|
Gonna automate it using ImageMagick, which is a CLI program, so I can use a bash loop. Photoshop has batch tools, I don't know how much they can do though.
And if I'd written my own program to do it, it would have skewed the image rather than used a perspective distort. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|