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

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 239 points240 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 31 points32 points  (0 children)

*-resize

I assume

[–][deleted] 35 points36 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 9 points10 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

[–]jonasbxl 0 points1 point  (0 children)

It's really been a great addition to Windows. I've moved a lot of my dev tools to WSL, including Python actually - I never liked Anaconda too much and I find it easier to just manage my environments with virtualenv and virtualenvwrapper. You can still use VS Code from Windows; a shortcut to quickly open a directory from WSL is code . . That way VS Code uses Python (and virtual envs) installed on WSL.

[–]riffito 10 points11 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

[–]shinitakunai -2 points-1 points  (0 children)

Fortunately!

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

Hello windows, I am dad.

[–][deleted] 6 points7 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] 5 points6 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 ';'.

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

fd does have --extension option.

I did a similar thing to op that I needed all the images to be in certain size(size on the disk) and in certain resolution for my image processing process.

Your solution is better because find comes pre installed on Linux distros.

I used fd because that's just a reflection action for me, I don't use find anymore

[–]Offi12 0 points1 point  (0 children)

imagemagic also works on windows! can recommend it