Sponsored Content
Top Forums Shell Programming and Scripting accepting images as a list and changing the name Post 302630321 by subway69 on Wednesday 25th of April 2012 05:31:18 PM
Old 04-25-2012
accepting images as a list and changing the name

Here is what I have so far

Code:
#!/bin/bash

while [ $# -gt 0 ]
do
        read image
        jpegtopnm $image | pnmscale -height 200 | pnmtojpeg > $image-thumb
        echo $image-thumb
        shift
done

I sorta threw some pseudocode in there to demonstrate what I'm trying to do. . Where I am stuck is, I am trying to read in a list of images. The while/do works fine but I get confused as to how to represent all the images in the list as a single item such as '$image' because I need to scale all of them and them spit them back out on the command line with new names by adding -thumb to their names. Also I'm trying to make it JPG specific meaning if the list gets a .html file for example by accident it should skip over it. My biggest problem is I dont know how to represent a list of items as a single variable if that is the right word. Any help just to get started in the right direction is appreciated. . thank you

---------- Post updated at 04:31 PM ---------- Previous update was at 04:29 PM ----------

edit here is an update to what I have changed

Code:
#!/bin/bash

for img in *.jpg
do

        jpegtopnm $img | pnmscale -height 200 | pnmtojpeg > $img-thumb
        echo $img
        shift
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Accepting User Input

I'm just starting out with UNIX and have figured some stuff out. I just need some help with accepting user input on the command line. For instance, I created a number counter that counts down from any positive hard coded number. But, I want the commnad line line to read "Countdown 20" where 20... (1 Reply)
Discussion started by: scott78
1 Replies

2. HP-UX

Oracle not accepting new connections

Hi UNIX guru's, Have recently upgraded Oracle from 8i to 10g on an HP-UX (RISC) 11.11 box. At least twice a day the database stops accepting incoming connections and the following errors are observed in the various logs. The box needs to be rebooted to get everything going again. The... (4 Replies)
Discussion started by: mat_cottrell
4 Replies

3. UNIX for Dummies Questions & Answers

accepting input date

I how do i accept a input date in script which is lesser than a specified day? ex: to accept a date less than or equal to 100 days(from today).?:( Thanks for the help in advance.:) (1 Reply)
Discussion started by: abhi_123
1 Replies

4. Shell Programming and Scripting

Accepting A-Za-Z

Is there a way accept A-Za-z0-9 from the user from a parameter? EX. I want to take the parameter from the user even if its hEu or H3y and store it as a parameter ( $1 ) (18 Replies)
Discussion started by: puttster
18 Replies

5. Shell Programming and Scripting

Help with Accepting Directories as an Argument

I'm doing a script where you are suppose to start off in accepting one or more directory as an argument. How do i do this? Sorry for the nub question. (2 Replies)
Discussion started by: LinuxUser232331
2 Replies

6. Shell Programming and Scripting

Accepting Input regardless of Case

Hi I am trying to get my script to accept input regardless if the person enters a or A. here is the portion of the code where I get the input. echo -n 'Please enter your choice:' # prompt user for input. read reply # read input echo case $reply in #... (2 Replies)
Discussion started by: DualPandas
2 Replies

7. Shell Programming and Scripting

changing the format of the list

I have a file such that List : a, b, c, d I want to list this as List a b c d however the trick is the number of arguments in the list is varies. There might be 0-7 variables . Can you help me? Please use code tags when posting data and code samples! (5 Replies)
Discussion started by: ozum
5 Replies

8. Shell Programming and Scripting

Bash function accepting list of strings and error message

I have a variable strLst containing a list of strings. I want to create a function that takes the list and an error message. If the number of strings is 0 or greater than 1, I print the error message. (1 Reply)
Discussion started by: kristinu
1 Replies

9. Shell Programming and Scripting

Bash Script to find/sort/move images/duplicate images from USB drive

Ultimately, I'm looking to create a script that allows me to plug in a usb drive with lots of jpegs on it & copy them over to a folder on my hard drive. So in the process of copying I am looking to hash check them, record dupes to a file, copy only 1 of the identical files (if it doesn't exsist... (1 Reply)
Discussion started by: JonaQuinn
1 Replies

10. Web Development

Changing Images in HTML

Hi, I recently bought shared hosting at asphostportal.com. Now, I have little problem. Could you help me please? How to change the images after every 5 seconds in html? The images should display in the same places for every 5 seconds? can anybody send me code please. Thanks. (4 Replies)
Discussion started by: minnawanda
4 Replies
img-ps(n)																 img-ps(n)

NAME
img-ps - Img, Adobe PostScript Format (ps) SYNOPSIS
package require Tk package require img::ps ?1.3? image create photo ?name? ?options? DESCRIPTION
The package img::ps is a sub-package of Img. It can be loaded as a part of the complete Img support, via package require Img, or on its own, via package require img::ps. Like all packages of Img it does not provide new commands, but extends the existing Tk command image so that it supports files containing raster images in the Adobe PostScript Format (ps). More specifically img::ps extends Tk's photo image type. The name of the new format handler is ps. This handler provides new additional configuration options. See section PostScript OPTIONS for more detailed explanations. Note that this package provides a pdf handler too, i.e. a handler for the Adobe Portable Document Format. That handler accepts the same options as the ps handler. The package delegates the actual conversion of data in PostScript and PDF format into a raster image to the ghostscript application. It therefore depends upon the presence of said application and is non-functional is ghostscript is not present. All of the above means that in a call like image create photo ?name? ?options? [1] Image data in ps and PDF format (options -data and -file) is detected automatically. [2] The format names ps and pdf are recognized by the option -format. In addition the value for the option is treated as list and may contain any of the special options listed in section PostScript OPTIONS. PostScript OPTIONS The handler provides two options, both influencing the reading of PostScript or PDF images. The handler is not able to write images in PostScript or PDF. -index n This option is for reading from PostScript/PDF data containing more than one page. When specified it will read the n'th page in the data. The first page is at index 0 and will be read by default, i.e. when the option is not specified. Note: This option is not yet implemented. -zoom X Y Multiply image size by the given scale factors. If Y is missing, the default is the same as X. X and Y are allowed to be in floating point format, but they are rounded to the nearest practically possible value. For postscript this means the zoom factors should be multiples of 1/72. REQUIREMENTS
The code provided by Img does not perform the interpretation and rasterizing of the input by itself but delegates this to the gs applica- tion. This is the GhostScript implementation of PostScript (and PDF). If gs is not installed this format handler cannot be used. SEE ALSO
img-bmp, img-gif, img-ico, img-intro, img-jpeg, img-pcx, img-pixmap, img-png, img-ppm, img-ps, img-sgi, img-sun, img-tga, img-tiff, img- window, img-xbm, img-xpm KEYWORDS
ghostscript, gs, image handling, pdf, postscript, ps, tk COPYRIGHT
Copyright (c) 1995-2003 Jan Nijtmans <nijtmans@users.sourceforge.com> Img 1.3 img-ps(n)
All times are GMT -4. The time now is 05:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy