LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 11-17-2004, 01:47 PM   #1
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Rep: Reputation: 16
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.
 
Old 11-17-2004, 02:16 PM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
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.)
 
Old 11-17-2004, 03:48 PM   #3
XsuX
Member
 
Registered: Oct 2004
Location: US
Distribution: Fedora Core 1
Posts: 43

Rep: Reputation: 15
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.
 
Old 11-17-2004, 04:17 PM   #4
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Original Poster
Rep: Reputation: 16
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
 
Old 11-17-2004, 04:38 PM   #5
tpe
Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Suse Linux
Posts: 98

Original Poster
Rep: Reputation: 16
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
 
Old 11-17-2004, 07:31 PM   #6
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
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.
 
Old 11-17-2004, 08:59 PM   #7
XsuX
Member
 
Registered: Oct 2004
Location: US
Distribution: Fedora Core 1
Posts: 43

Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A question about BASH operand Linux - Newbie 2 11-27-2005 09:49 PM
Bash Question mbjunior99 Programming 5 08-31-2005 04:33 AM
a bash question about while jiawj Linux - Newbie 3 07-14-2005 11:45 AM
bash question? shanenin Linux - Software 1 11-26-2004 12:22 PM
bash question shanenin Linux - Software 3 02-14-2004 06:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration