Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unix error: Is a directory #13

Closed
KasiMaru opened this issue Aug 30, 2018 · 6 comments
Closed

unix error: Is a directory #13

KasiMaru opened this issue Aug 30, 2018 · 6 comments
Labels

Comments

@KasiMaru
Copy link

KasiMaru commented Aug 30, 2018

Hi and thanks for the great cli!
I've used it before and everything was ok, but now when I'm -i ./big/* -o ./mini resize 200 I'm getting:

vips__file_open_write: unable to open file "/Users/myname/Desktop/mini" for writing
unix error: Is a directory

Am I doing something wrong?

@detj
Copy link

detj commented Sep 4, 2018

I'm getting this error too. Trying to convert a png to jpg.

npx sharp-cli -i ~/Desktop/file.png -o ~/Desktop -f jpg

says

vips__file_open_write: unable to open file "/Users/detj/Desktop" for writing
unix error: Is a directory

And specifying a path

npx sharp-cli -i ~/Desktop/file.png -o ~/Desktop/file.jpg -f jpg

says

vips__file_open_write: unable to open file "/Users/detj/Desktop/file.jpg/file.jpg" for writing
unix error: Not a directory

@pdehaan
Copy link

pdehaan commented Nov 29, 2018

Me too. I'm trying to resize a directory of images so they have a max-width of 100px and am getting the following error (where the output folder ./logos/ already exists):

$ npx sharp-cli -i public/img/logos/*.png -o logos/ resize 100

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-darwin-x64.tar.gz
vips__file_open_write: unable to open file "/Users/pdehaan/dev/github/../logos" for writing
unix error: Is a directory
vips__file_open_write: unable to open file "/Users/pdehaan/dev/github/../logos" for writing
unix error: Is a directory

@joejemmely
Copy link

Hi @pdehaan, you need the specifiy the output files.
npx sharp-cli -i public/img/logos/*.png -o logos/{name}{ext} resize 100 --min

@pdehaan
Copy link

pdehaan commented Nov 30, 2018

@joejemmely Thanks, that seems to get me closer! I didn't see the --min flag in the README, so I'll try digging through the code and see if I can figure out exactly what it's changing.

It seems like without the --min flag, my logos are now being cropped at 100px wide and 100px high (instead of 100px wide and a variable height w/ aspect ratio). If I do add the --min flag, it seems to resize my images so they are a minimum of 100px high (not just wide), so now some of my logos that were 233x26 (1,985 bytes) get resized up to 896x100 (87,308 bytes).

But as it turns out, specifying --max gives me exactly what I wanted! Thanks again!

@detj
Copy link

detj commented Dec 7, 2018

For folks stumbling here, following @joejemmely's comment, I solved my issue like this

$ npx sharp-cli -i ~/Desktop/file.png -o ~/Desktop/{name}.jpg -f jpg

And that did the trick! Thanks @joejemmely

This was referenced Jan 7, 2019
@mimecine
Copy link

I wish the {name}{ext} was mentioned in the documentation and in one the examples...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants