Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-17-2004, 01:47 PM
|
#1
|
Member
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98
Rep:
|
BASH question (SOLVED)
Hallo,
I have a BASH related question. I am not sure that I post at the right forum, so my apologies if so.
Now the problem:
I use the following script in order to convert a few 100 images to different sizes:
Code:
for i in *.jpg; do
convert "$i" -quality 75 +resize "300" +sharpen "1x34" -crop "300x200+0+0" "$i.300";
convert "$i" -quality 75 +resize "225" +sharpen "1x34" -crop "225x150+0+0" "$i.225";
convert "$i" -quality 75 +resize "150" +sharpen "1x34" -crop "150x100+0+0" "$i.150";
done
When I run the script "convert" tells me that:
Code:
convert: Unable to open file (300) [No such file or directory].
convert: Unable to open file (225) [No such file or directory].
convert: Unable to open file (150) [No such file or directory].
Please note the period at the end of each line. Since the images are created with the .300, .225, .250 extension, the problem seems to be the "$i.300" at the command. Obviously I do not know a lot about bash, so eny help would be appreciated.
Thank you
Peter
Last edited by tpe; 11-17-2004 at 04:38 PM.
|
|
|
11-17-2004, 02:16 PM
|
#2
|
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018
Rep:
|
Try using -sharpen instead of +sharpen. I think the + is only used for options that can be disabled. That +/- syntax with ImageMagick is pretty confusing (-antialias to turn antialising on, +antialias to turn it off, etc.)
|
|
|
11-17-2004, 03:48 PM
|
#3
|
Member
Registered: Oct 2004
Location: US
Distribution: Fedora Core 1
Posts: 43
Rep:
|
Have you tried taking the quotation marks away from around the $i ? IDK, but that doesn't seem quite right...
Also have you tried
for i in `ls *.jpg`
Or is that not what you want? I'm just sort of throwing ideas off the top of my head, so don't take them too seriously, but personally that's what I would try. Because, methinks, the way it is, it's looking for a file called "*.jpg"
edit: those are back quotes around ls *.jpg, same key as the ~
Last edited by XsuX; 11-17-2004 at 03:51 PM.
|
|
|
11-17-2004, 04:17 PM
|
#4
|
Member
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98
Original Poster
Rep:
|
Quote:
Originally posted by wapcaplet
Try using -sharpen instead of +sharpen. I think the + is only used for options that can be disabled. That +/- syntax with ImageMagick is pretty confusing (-antialias to turn antialising on, +antialias to turn it off, etc.)
|
I did but it didn't work!
I also tried to play a littl bit with the values of sharpen that I use from GIMP (Filters, Enhance, Sharpen) with is 34. And the best solution I found was +sharpen 1x34 
|
|
|
11-17-2004, 04:38 PM
|
#5
|
Member
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98
Original Poster
Rep:
|
Quote:
Originally posted by XsuX
Have you tried taking the quotation marks away from around the $i ? IDK, but that doesn't seem quite right...
Also have you tried
for i in `ls *.jpg`
Or is that not what you want? I'm just sort of throwing ideas off the top of my head, so don't take them too seriously, but personally that's what I would try. Because, methinks, the way it is, it's looking for a file called "*.jpg"
edit: those are back quotes around ls *.jpg, same key as the ~
|
Thank you for you tips but I use ` at rpm -ql `rpm -qa | grep -i pachagename", since I do not want to use 2 commands 
Now:
If you remove the " then, in case a file is named "blabla large.jpg" you have a problem! The `ls *.jpg` is the same thing as "for i" and since i is replaced by the blabla large.jpg, you do not have a problem...
After a few tests (the -verbose is very usefull!), I found that the problem is on the "+resize 300". I changed the + with - and everything is fine! I suppose that I have to escape the + or something like this.
Thank you for your time and help 
|
|
|
11-17-2004, 07:31 PM
|
#6
|
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018
Rep:
|
Quote:
Originally posted by tpe
After a few tests (the -verbose is very usefull!), I found that the problem is on the "+resize 300". I changed the + with - and everything is fine! I suppose that I have to escape the + or something like this.
|
Doh, that is what I meant to say  There is no +resize option, only -resize. I suspect the +resize was being ignored, and the "300" was being interpreted as a filename.
|
|
|
11-17-2004, 08:59 PM
|
#7
|
Member
Registered: Oct 2004
Location: US
Distribution: Fedora Core 1
Posts: 43
Rep:
|
Quote:
Originally posted by tpe
Thank you for you tips but I use ` at rpm -ql `rpm -qa | grep -i pachagename", since I do not want to use 2 commands 
Now:
If you remove the " then, in case a file is named "blabla large.jpg" you have a problem! The `ls *.jpg` is the same thing as "for i" and since i is replaced by the blabla large.jpg, you do not have a problem...
After a few tests (the -verbose is very usefull!), I found that the problem is on the "+resize 300". I changed the + with - and everything is fine! I suppose that I have to escape the + or something like this.
Thank you for your time and help
|
ahhh... like I said, I didn't really understand what you were trying to accomplish there, so my ideas were very, very broad. Glad you figured it out, tho.
|
|
|
All times are GMT -5. The time now is 07:59 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|