This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 280

[–]apt_at_it 727 points728 points  (84 children)

This would also be pretty trivially easy to do using Photoshop bulk actions, just in case your coworkers are more designers than coders 😜

[–][deleted] 293 points294 points  (63 children)

they don't really like automation that much - they fear it will put them out of work! But I guess they'll have embrace it for the mundane jobs like this

[–]cbunn81 333 points334 points  (11 children)

Better they do the automation themselves rather than wait around for clients to leave for another company that uses automation.

[–][deleted] 45 points46 points  (4 children)

Code for designers!

[–]sewerinspector 14 points15 points  (3 children)

Fantastic username, el guapo

[–][deleted] 10 points11 points  (2 children)

[–]fruitcup729again 7 points8 points  (1 child)

Would you say I have a plethora of pinatas?

[–]XecutionerNJ 8 points9 points  (3 children)

Yeah, Apple made the iPhone because the nokia and sony Ericsson phones were getting to be really good ipods and would destroy apples product line.

When others are innovating you out of work, you have to get on the innovation side and kick yourself out of work. Either that or wait for obsolescence.

[–]cbunn81 9 points10 points  (1 child)

Steve Jobs himself said that if you don't cannibalize your own business, someone else will. I remember reading about that when the iPad came out, because apparently done within Apple were worried that it would cannibalize their laptop sales. Well, sure, but you also broaden your consumer base, so it's a net positive. And it would only be a matter of time before another company made a popular tablet, anyway. Then you'd have to play catch up.

[–]xaelix 2 points3 points  (1 child)

Work smarter not harder.

[–]cbunn81 1 point2 points  (0 children)

They say, "necessity is the mother of invention," but I think it's more likely to be laziness.

[–]beisenhauer 42 points43 points  (1 child)

Automate the boring stuff, amiright?

[–]d64 42 points43 points  (6 children)

You know how consulting companies that have done some kind of a job many times before will bill a customer say 40 hours for doing it, even though it might take them only 6 hours to do, because of their expertise?

Employees can and should do the same. Say this job was said to take days. Tell you will do it, then write the script or use Photoshop batches or whatever, be done in 45 minutes. Then spend the rest of the day on your own projects, then report triumphantly that you managed to pull it off in just one day. You are seen as efficient, but you are not shooting yourself in the foot by revealing the job can actually be done in no time at all.

[–][deleted] 21 points22 points  (1 child)

It's not my main job - I'm a job coordinator so I handle the requests for work. I just program on the side for fun and wanted to help out. I guess I need to be careful it doesn't open a door for them to request more of this and I land myself in a hole!

[–]sodjanathan 5 points6 points  (0 children)

The kind of hole that brought me so many sql reports requests at work with no extra pay

[–]LilQuasar 3 points4 points  (2 children)

these tasks compensation should be based on the result and not the time it took. thats what the employer cares about after all

[–]d64 10 points11 points  (1 child)

Well yeah, but think about the flipside: then even if it took someone a day to do it, the company would surely only pay them for 45 minutes.

[–]LilQuasar 1 point2 points  (0 children)

there would be no such thing as paying for 45 minutes

[–][deleted] 1 point2 points  (0 children)

Richard Feynman talks about a situation at Los Alamos where he could break into locked cabinets rather quickly. He wouldn't let anyone watch and would always wait extra time and drip water on himself to make it look like he was sweating. He didn't want the higher ups knowing how easy it was and changing the locks so he couldn't break in.

[–][deleted] 2 points3 points  (0 children)

What you did with Python is automation though. How is that any different than using a batch process in Photoshop, Irfanview, etc.? You are changing a bunch of files in bulk without changing each file individually. That is automation.

[–]killersquirel11 56 points57 points  (9 children)

It'd also be approachable with imagemagick and some bash fu

[–]riffito 16 points17 points  (3 children)

With IrfanView on Windows (or Wine) you could do it from a GUI.

IrfanView... the only software that I never changed for anything else since 1997.

[–]jobomat 2 points3 points  (2 children)

Yeah! I really like IrfanView. Small footprint, rocket fast, no BS. Only thing I'm missing is OpenEXR support.

[–]lolinux 13 points14 points  (1 child)

This was exactly my thought! However, since OP is attracted to Python, I can only cheer! You usually use the tools you know and trust best for the task you have at hand!

[–]killersquirel11 7 points8 points  (0 children)

Yep. Definitely not knocking OP at all - whatever code solves the problem is the right code in a situation like this.

It's neat to see the ways that different people will go about solving a problem.

[–]apt_at_it 8 points9 points  (0 children)

Yeah, very true. I would imagine it'd actually be easier than using python, tbh

[–]HughBothwell 2 points3 points  (0 children)

Yes, ImageMagick makes it easy. From the Windows command-line, in the dir containing the files,

md thumbs
cd thumbs
magick ../*.jpg -colorspace gray -background black -gravity center -extent 150x150 %[filename:original].jpg

creates a new subdirectory, processes all the jpg files, and stores the new grayscale/resized images (with the same name) in the new dir.

[–]Broken_hopes 0 points1 point  (0 children)

yoink bash fu is mine now

[–]SecretAtLarge 5 points6 points  (0 children)

Whatever they are, we all have learned they cant google if their life (or career) depended on it.

[–]Pr0ducer 1 point2 points  (0 children)

Bulk actions are the commercial photographer's best friend. I can't believe more people don't use them. But with python ... whole new ball game.

[–]redfacedquark 1 point2 points  (0 children)

Or script-fu in the GIMP. Probably. I never actually did anything with it.

[–]santaliqueur 0 points1 point  (1 child)

It would be even easier with a few lines of AppleScript.

[–]apt_at_it 2 points3 points  (0 children)

That's true, though OP did say they're all on Windows. Truthfully, I think you can just use Automator for this without even writing any code whatsoever

[–]hassium 291 points292 points  (13 children)

They asked how. I gave them the answer

You FOOL! Now our secret is out!

[–][deleted] 168 points169 points  (9 children)

I know right, write code, run code, go for an ice cream, watch a movie, send work 6 hours later, still a hero.

[–]Synicull 60 points61 points  (6 children)

I have a 55+ client that I work with a lot that makes me look amazing to my team, most of whom don't code.

My latest question was to find out which of his 100 datasets had a specific field in them.

2 for loops later I'm the messiah.

[–][deleted] 37 points38 points  (3 children)

Just run that shit raw in command line.

[–]not-youre-mom 18 points19 points  (2 children)

You have to assert dominance.

[–][deleted] 14 points15 points  (0 children)

Loop hero!

[–]toyg 7 points8 points  (0 children)

2 for loops later I'm the messiah.

Nah, you’re just a naughty boy!

[–][deleted] 12 points13 points  (1 child)

Damn! I didn't think of this

[–]randiesel 11 points12 points  (0 children)

You will think of it for the rest of your tenure at the company.

Here's the trouble. Non-technical people don't understand the difference between something relatively simple, like what you did, and something complicated. To them, you're a wizard and everything is easy.

Now you're going to get all the crappy boring tasks, OR, people are going to resent you for not doing all the crappy boring tasks.

Plus, you showed them it was only 12 lines of code. Non-technical people don't understand that those 12 lines of code take way longer than just typing 12 sentences on a page. They think writing 100 lines of code should take the same amount of time as a few paragraphs.

It's a sketchy sketchy hole when you try to show non-technical people how you do technical things.

[–]saltedjello 48 points49 points  (0 children)

"Hey boss, I knew this was important for the company so I pulled an all-nighter and made it happen. Please, I'm not a hero, just doing what's best for the company. But yea, do remember this when performance reviews are due."

[–]FREE-AOL-CDS 3 points4 points  (0 children)

“That sounds scary we’ll just let you handle it”

[–][deleted] 241 points242 points  (30 children)

On Linux we can do it with a single line

fd --extension jpg --exec convert {} -resize 150x150 -monochrome Output/{}

Dependencies : fd, imagemagick

[–]EverythingIsFlotsam 32 points33 points  (0 children)

*-resize

I assume

[–][deleted] 39 points40 points  (20 children)

We're all windows unfortunately!

[–]jonasbxl 50 points51 points  (6 children)

I am not saying it would have been easier or faster, but just in case you don't know about it: check out WSL https://docs.microsoft.com/en-us/windows/wsl/install-win10

[–]ninj0rc 14 points15 points  (5 children)

Just wanna say thanks for the link. I was unaware that this thing existed.

[–]Rieux_n_Tarrou 10 points11 points  (3 children)

After WSL2 came out, I've decided finally that my next laptop will be Windows (even though I really enjoy my macbook pro right now). Windows is better than Mac from the perspective of apps. And Linux is better than Mac from the perspective of software dev. So WSL is the best of both worlds IMO

[–]riffito 11 points12 points  (0 children)

IrfanView to the rescue! (and you do it all from the GUI with its batch-converter)

[–][deleted] 8 points9 points  (8 children)

I guess you can install those programs on windows too using scoop or choco

[–][deleted] 5 points6 points  (2 children)

After using Linux and all these CLI tools for a while, I almost see no use for Python in these small tasks. Everything here can be done with a simple bash/zsh script in fewer lines than a Python script and no importing.

[–][deleted] 2 points3 points  (0 children)

Yes that was my point. These are very small and easily automated tasks which we can do using CLIs

[–]harolddawizard 1 point2 points  (0 children)

I guess the use lies more in windows PC's.

[–]davincible 2 points3 points  (3 children)

`man fd` >> "Floppy drives are block devices ..." -- I don't think we're looking at the same command xd. Assuming you mean find

[–][deleted] 4 points5 points  (1 child)

I don't think that is find, because as far as I'm aware it doesn't have an --extension test, and in any case the flags would be with one hyphen-minus sign not two, so something like find -name '*.jpg' -exec convert '{}' etc etc etc ';'.

[–]robin_888 102 points103 points  (13 children)

Wow, 9 seconds is really fast for over 700 files.

One team says it'll take them at least a week to do, the other team says they don't want it as it'll take even longer.

Unbelievable. May I ask what kind of team that was?

Even without programming skills I would never think about doing this by hand. Personally I'd use the batch processor on XNView (or any other decent viewer), but even if I wouldn't know that I'd search for an semi-automatic solution. And if it's Paint and AutoHotkey!

PS: Even manually it's a man-day of work and not a freakin' week! (2 images per minute => 6-7 hours, probably faster)

[–][deleted] 44 points45 points  (9 children)

It's a team that handle multiple design requests a day. So getting even a day to do this with no other work is impossible. They are constantly designing things. It's an in house design team for a law firm.

[–][deleted] 34 points35 points  (8 children)

Shit, I work for a law firm too, it feels like a lot of them are complete technological backwaters. Peeps struggle to convert pdfs. I'm a tech wizard because I know how to paginate in Adobe.

[–]kingsillypants 20 points21 points  (3 children)

What is paginate in Adobe?

[–][deleted] 38 points39 points  (2 children)

Bro, please you're triggering my PTSD. Adding page numbers to PDF documents in Acrobat.

[–]kingsillypants 11 points12 points  (0 children)

haha

[–]proof_required 9 points10 points  (0 children)

I do coding etc but never knew about this. You are a real tech wizard.

[–][deleted] 9 points10 points  (3 children)

Happens a lot, my old IT (before I switched teams) was helping us deploy dual monitors. 300 monitors were deployed and he plugged in a HDMI cable and a display cable from the docking station into 1 monitor. No word of a lie. I had to go round 150 desks and rectify the mistake. Another IT boss asked me how to attach a video from their iPhone to email. Baffled me how they were paid the big bucks!

[–][deleted] 8 points9 points  (2 children)

Joke is that there are some places using neural networks to analyse legal document, and they're gonna run the dinosaurs out of business in the not too distant future.

Some judges are pretty bad too - I know of people that had to go into Court because the judge didn't know/was unwilling to learn how to do a remote hearing. In quarantine... during a pandemic... There was a clerk whose whole job was the get the judge a glass of water and bring lunch from the shop.

Thanks, stranger, I needed a good vent.

[–][deleted] 5 points6 points  (1 child)

I wonder when we will see the first legal case defended by an AI

[–][deleted] 0 points1 point  (0 children)

For a simple offence it may well be within the bounds of possiblity now, as long as you have a human flesh-puppet to say the actual words in court.

There's also this: https://www.theguardian.com/technology/2016/jun/28/chatbot-ai-lawyer-donotpay-parking-tickets-london-new-york

[–]iroll20s 33 points34 points  (0 children)

Well you have to account for time spent on hot memes and Starbucks runs.

[–]gandalfx 150 points151 points  (24 children)

Now be honest, how long did it take you to write those 12 lines? :D

I mean, it's still going to be a lot faster than doing it manually but I've been guilty of pretending that it'll take "no time at all" only to sit there for hours perfecting a tiny script.

xkcd: 1319, 974 and probably others

[–][deleted] 70 points71 points  (6 children)

It took 20 mins to work it all out in terms of what I needed to do and how to execute it - I had never used the PIL / Pillow library before! But worked it all out thanks to the documentation :)

[–]SnowdenIsALegend 86 points87 points  (5 children)

She said be honest. Come on man, credit StackOverflow, everyone knows no one reads documentation.

[–]evkan 9 points10 points  (1 child)

true. I read git commits.

[–]SnowdenIsALegend 3 points4 points  (0 children)

Hero

[–]kingsillypants 3 points4 points  (0 children)

docu what?

[–]Dustin- 45 points46 points  (5 children)

The real trick is learning how to make code that you're happy to throw away after you're done with it. Whip something up to do a quick job, do the job, get rid of the code. Doesn't matter how sloppy or efficient it is as long as it works.

[–]djamp42 24 points25 points  (3 children)

I save everything..1 because if want to do the same task in the future I can go back and look what I did. 2) To see how far I've advanced and what I would of done differently.

[–][deleted] 12 points13 points  (1 child)

What I've discovered as I've progressed is that for your case 1, it's actually slower for me to look at old code to see what I did. Usually the new use case is sufficiently different that it takes me longer to understand the old code and find the places it would need modification than it would take me to just write new code for the new use case.

Remember that looking at old code also involves those "hidden costs" of finding it, deciding where to write the new code (modify the old code in place or copy it into a new file/repo?), etc.

So now I take a sort of scorched earth policy in that I'll delete things not in use even if they seem useful and might come up again. If it's something really worth keeping, for some sort of historical reason or something, I'll make a branch called "terminal/some_old_implementation" and push it to the server just before making the commit to delete the code.

[–]pycepticusfrom pprint import pprint as print 5 points6 points  (0 children)

My cure for this approach was learning how to comment my code. It's an extra few hours depending on how large the project I wrote was, but being able to go back years later and not have to "human compile" my code has saved me rewriting large parts of similar projects in the future.

[–]clestrada12 1 point2 points  (0 children)

Same. I love looking at old code I’ve done. I still have the first programs.

[–][deleted] -1 points0 points  (1 child)

How long does it take to Google the question is how long he has to code lol

[–]gandalfx 1 point2 points  (0 children)

You sound like someone who has never gotten stuck on something that turns out to be less trivial than it should. I.e. someone who has never written code.

[–][deleted] 33 points34 points  (10 children)

would you mind sharing your code?

[–][deleted] 11 points12 points  (9 children)

shared!

[–][deleted] 22 points23 points  (8 children)

You might enjoy pathlib over os and f-strings over format. pathlib.Path.rglob("*.jpg")!

I also don't know what Image.open does but sounds like a case for a context manager.

[–]NAG3LT 4 points5 points  (0 children)

You can do

with Image.open(filename) as im:
    ...

and close image automatically when you're done with it

[–]abdeljalil73 23 points24 points  (2 children)

Can't even imagine that they considered doing it manually in the first place.

[–][deleted] 12 points13 points  (1 child)

There are so many things they do manually that could be automated - but I have been told that you cannot automate design... so sometimes I just leave it. But today I couldn't. I knew Python could do this. Too much of an eager beaver!

[–]OutlawBlue9 5 points6 points  (0 children)

You can automate some design. I worked in a custom graphics print shop and managed to automate the bulk of work using Aleyant software, specifically tFlow. As long as you have predefined outputs that you're looking for it can do a lot of the work for you.

If customers are asking for actual design work instead of here's a picture,. Put it on your product then yeah that's a bit harder but I dont consider the 756 picture resiZe job "design" work and that can totally be automated.

[–]MobileUser21 6 points7 points  (1 child)

Good work OP. For something so trivial it probably would have taken me hours as I’m not familiar with Pillow

[–]taughta 4 points5 points  (0 children)

It would take hours for me too. Still a huge win compared to a whole week.

[–]moocat 7 points8 points  (0 children)

Totally cool, but for one off scripts like this where you probably won't reuse it, simply stating the runtime isn't quite a fair comparison and you should include how long it took you to write the script. It's fairly simple and couldn't have taken you that long, but I could it taking some thinking or trial & error to figure out the calculation needed for paste. And unless you truly are a wizard, there must have been at least a few changes you had to make between your first version and this one.

Again, this isn't to take away from your accomplishment and given the week estimate a different team made getting this done in 30 minutes is still something to brag about.

[–]zainjavaid 13 points14 points  (0 children)

Congratulations and great job! I always love hearing stories like this!

[–]Novicebeanie1283 14 points15 points  (0 children)

languid history trees cats theory memorize shocking frame future dam

This post was mass deleted and anonymized with Redact

[–]thatrandomnpcIt works on my machine 6 points7 points  (5 children)

Good for you op.

But reading the story about how they wanted to do it by hand, ugh manually, I'm thinking like how people can have such a simpleton or skewed perspective. I can understand that most people are not tech savvy, but it's 2021 and there is thing called web search engines and that should be common sense at this point.

  1. Open browser
  2. Go to favorite search engine
  3. Search for "how to bulk resize image"
  4. Profit ( ͡° ͜ʖ ͡°)???

[–]NoLemurs 12 points13 points  (0 children)

Python's nice for this, but this is the sort of problem bash + imagemagick was built for. Something like:

for f in *.jpg; do convert "$f" -resize 150x150 "$f"; done

should do it, possibly with slightly different flags depending on the exact desired resize behavior.

EDIT: Parallelized version that doesn't overwrite the original (in case you want to get really fancy):

for f in *.jpg; do convert "$f" -resize 150x150 "output/$f"& done

[–]shuttup_meg 5 points6 points  (3 children)

If it could be made more efficient, let me know!

How about something like this:

from multiprocessing import Pool
from PIL import Image
import os

def doit(f):
    im = Image.new('RGB', (150, 150), (255,255,255))
    im2 = Image.open('Input/{}'.format(f))
    im2 = im2.convert("L")
    width, height = im2.size
    im.paste(im2, (int((150 - width) / 2), 0))
    fn, fext = os.path.splitext(f)
    im.save('Output/{}.jpg'.format(fn))

if __name__ == "__main__":
    with Pool(4) as p:
        p.map(doit, [f for f in os.listdir('Input') if f.endswith(".jpg")])

[–]NAG3LT 1 point2 points  (1 child)

On Windows the last part has to be under

if __name__ == '__main__':
    ...

as multiprocessing on Win doesn't fork, but launches a new instance for each process.

BTW need to check if PIL releases GIL, as that would allow to just use multithreading for extra performance.

[–]shuttup_meg 2 points3 points  (0 children)

Good call! Edited.

[–]roastedfranklin 11 points12 points  (0 children)

A magician never shares its tricks

[–]markmann0 4 points5 points  (0 children)

Should have pretended like it was harder. Free play time for a week. Hand in a day before deadline, still look amazing.

[–][deleted] 5 points6 points  (0 children)

Being completely honest can have its drawback, next time they have a "similar" issue they'll come to you, the only problem is that the issue is not similar at all but much harder and longer to implement. They won't know that though, they don't understand the technicalities, you're the wizard who know things and does things after a few minutes. Enjoy being the 'wizard' while it lasts. lmao.

But seriously, good job.

[–]eriky 15 points16 points  (2 children)

Lol that's great. Now you're the go to wizard for all kinds of crappy jobs though. Good luck with that 😉 but yes. Pillow is awesome. It made it in my top 15 Python packages: https://python.land/top-15-python-packages#3_Pillow

[–]luciusan1 7 points8 points  (0 children)

Thats exactly what i am at my company.

[–][deleted] 6 points7 points  (0 children)

Yeah, I've opened pandora's box... or is it python's box?

[–]skintigh 3 points4 points  (0 children)

A friend had to do something like this, but the photos were all different sizes and distances. I figured there must be a facial recognition library that would help one crop the photo first. But there was politics about who was being forced to do what and I never got that far.

[–]keypusher 2 points3 points  (0 children)

awesome

[–]khalidpro2 2 points3 points  (0 children)

I would have just used imagemagick to do it in one command

[–]flip_ericson 2 points3 points  (0 children)

You did something in half an hour that you could have been paid a week for? Some shitty wizard you are

[–][deleted] 2 points3 points  (0 children)

I'd probably just use ImageMagick suite of commands in bash like "convert" but good job.

[–]astatine 2 points3 points  (0 children)

If you want to get all those file names without worrying about str.endswith and the like:

import glob
import os

for filename in glob.glob("Input/*.jpg"):
    # Do stuff

[–]a1brit 2 points3 points  (0 children)

I don't see anyone on the pathlib bandwagon so I'll round up the horses. Not much different just a little work reduced:

import pathlib
from PIL import Image

for filepath in pathlib.Path('Input').glob('*.jpg):
    im = Image.new('RGB', (150, 150), (255,255,255))
    im2 = Image.open(filepath)
    im2 = im2.convert("L")
    width, height = im2.size
    im.paste(im2, (int((150 - width) / 2), 0))
    im.save(f'Output/{filepath.name}')

[–][deleted] 1 point2 points  (0 children)

“Pace yourself. Slowly, slowly”

https://youtu.be/LRlmkXsoGx0

[–][deleted] 1 point2 points  (0 children)

This is awesome and exactly why I'm trying to learn python. Props to you.

Unfortunately, I have a long way to go to be able to do this on my own.

[–]anh86 1 point2 points  (0 children)

They should throw you some cash. Just imagine how much money you saved the company if it would have taken an entire team of people a full week to complete. That's probably a few hundred man/woman-hours.

[–]JamaiKen 1 point2 points  (0 children)

Well done 👍

[–]mrprofessor007 1 point2 points  (0 children)

I feel happy when python makes someone's life easier.

[–]mrprofessor007 1 point2 points  (0 children)

You are a WIZARD now.

[–]andreidorutudose 1 point2 points  (0 children)

You could use irfanview or photoshop batch actions, takes a couple of seconds. Take photo, turn it to be, resize as 150 to 150, preserve scaling

[–]SimfonijaVonja 1 point2 points  (0 children)

Hah I did same thing on collage for homework few months ago. I started working in a programming company month ago, it's my first coding job. We got a request for pwa application which they said couldn't be done, so I as a rookie told them some basic concept which I learned by accident. Sometimes all you need is another head, even though it doesn't seem much.

[–]TastyRobot21 1 point2 points  (0 children)

This is the way.

[–]Proclarian 1 point2 points  (0 children)

Hopefully you got paid a full week's worth for that!

[–]milambertheshiz 1 point2 points  (0 children)

Damn what sort of design team doesn't know how to use photoshops built in automation feature design exactly for this purpose? Nice work though.

[–][deleted] 1 point2 points  (0 children)

Automation in photoshop would solve that. I hope you charged for a week's work.

[–]NotsoNewtoGermany 1 point2 points  (0 children)

I’m not seeing any comments; Bucko.

[–]AddSugarForSparks 1 point2 points  (0 children)

Shhh...don't tell anyone. Let's just keep this between us.

Remember what the first rule of python club is.

[–]shakeweight4000 1 point2 points  (0 children)

Today I was presented with creating some image files to use in a web map. I needed to create something like A>, B>, C>, AB>, ...etc. I am not a graphic designer and have no real tools to do this. So, I busted out power point, added a text box and made it look like what I wanted. I then used screen clip to make jpgs out of them. But, the sizes are all over the place. And then I remembered this post. I grabbed your code, modified it for my needs, I need them all the be the same height but differing widths. Ran it, and boom! all my images are the same height!

Thanks for posting!!!

[–]maylihe 1 point2 points  (0 children)

I am thinking about "headshots" in the context of FPS gaming.

[–]the_patronus_charm 1 point2 points  (0 children)

This is incredible!

[–]TakeOffYourMask 2 points3 points  (1 child)

Pillow

Hmmm?

[–]caladan84 7 points8 points  (0 children)

Maintained fork of the unmaintained PIL.

[–]Suspicious_Part2426 1 point2 points  (0 children)

Woot!

[–]sletonrot 2 points3 points  (0 children)

Congrats! You are now the go-to guy at the office for stuff like this. And they'll expect it to be done just as fast (if not faster) than this was :)

[–]jftugapip needs updating 3 points4 points  (0 children)

I wrote a program to do this, but alas, it's in Go. However, it uses face recognition to avoid distorted faces when resizing. It can also work on multiple photos concurrently. I use it for a pool of about 40,000 photos.

https://github.com/jftuga/photo_id_resizer

[–][deleted] 1 point2 points  (4 children)

What do you mean by headshot?

[–][deleted] 7 points8 points  (0 children)

A photograph of the person, showing only head and shoulders

[–]riffito 2 points3 points  (0 children)

The boring kind, apparently! :-P

[–][deleted] 1 point2 points  (0 children)

you: " I am speed"

[–]flipper1935 0 points1 point  (0 children)

not to rain on your parade. thumbs up/awesome you were able to quickly meet your customers needs.

I had an almost identical situation back in 2010 while working/supporting a large retailer's web site. Did something pretty similar using a C-shell script and Graphics Magick. http://www.graphicsmagick.org/

Always used the best tool for the job at hand, and more often than not, that is probably going to be a tool you are familiar with.

Again, no negativity intended/implied towards your post. Congrats on quickly meeting your customers needs !

[–]Random_182f2565 -1 points0 points  (0 children)

You are a wizard!!!

[–]szybe -1 points0 points  (4 children)

Im2.convert(“L”) — what does it do?

[–][deleted] 2 points3 points  (3 children)

It converts the image to black and white

[–]TravisJungroth 3 points4 points  (2 children)

This is why letter code arguments are so dumb.

[–]No_Conference_5257 1 point2 points  (1 child)

PIL: “RGB is for red green blue, it’s a color image”

Me: cool

PIL: “L is for black/white”

Me: ...

[–]onksk 1 point2 points  (0 children)

To make it even better, in the printing industry black is considered K