Sponsored Content
Top Forums Shell Programming and Scripting Loop through directory convert jpg to png Post 302514576 by Drayol on Saturday 16th of April 2011 08:35:49 PM
Old 04-16-2011
Loop through directory convert jpg to png

Hi guys. I will be frequently needing to convert .jpg files to 183x183 .png thumbnails. I can't quite seem to wrap my head around how to make a for loop to do this.

With the help of my friend (who may have mislead me, I'm quite confused) I've got this.

This is bash

the command is: pngify <source directory> <destination directoy>
Code:
for picture in $(?) ====> I'm quite sure this part is wrong...
do
        echo ${picture%.*}>picturewithoutext     =====|This part is to remove the 
        picnoext=`cat picturewithoutext`               =====|extension so I can name 
        rm picturewithoutext                   ======== ===|the new file the same thing with a .png

        convert -size 183x183 $1/$picture $2/$picnoext.png  
done

Yes, I am very new to shell scripting ^_^;;

Last edited by Drayol; 04-16-2011 at 10:09 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Print the content of a directory in jpg file

Is there any possible way to print the contents of a directory to a .jpg file? I have a list of thumbnails (e-books) which I want to share (+500) but I don't know how to make this. I would appreciate a lot any comments regarding this issue. (4 Replies)
Discussion started by: agasamapetilon
4 Replies

2. Shell Programming and Scripting

Simple BASH shell script to rename webcam jpg and copy into a new directory.

System: Ubuntu Intrepid Ibex I'm running webcamd as a sort of "security" program, but I need a script that will archive my webcam.jpg files. So, take the following file: /home/slag/www/webcam.jpg Rename it--preferably with a time stamp. Place it in say: /home/slag/www/history/ ... (4 Replies)
Discussion started by: robfindlay
4 Replies

3. Shell Programming and Scripting

makefile to convert .jpeg to .png thumnails

Hello! I'm desperately trying to write a makefile that converts and scales jpeg files to png files in subdirectories I want to use netpbm, so I just need the commands: anytopnm pnmscale pnmtopng For various reasons i want to use a makefile. This is the first time i use the make tool... (1 Reply)
Discussion started by: henningbaer
1 Replies

4. Shell Programming and Scripting

Rename all ".JPG" files to ".jpg" under all subfolders...

Hi, Dear all: One question ! ^_^ I'm using bash under Ubuntu 9.10. My question is not to rename all ".JPG" files to ".jpg" in a single folder, but to rename all ".JPG" files to ".jpg" in all subfolders. To rename all ".JPG" to ".jpg" in a single folder, for x in *.JPG; do mv "$x"... (7 Replies)
Discussion started by: jiapei100
7 Replies

5. Shell Programming and Scripting

how to convert this to a loop

I have a list of files in the same directory need to do the following cut -d "=" f2 file1 > file1_result cut -d "=" f2 file2 > file2_result ... past file1_result file2_result .... >file_sum How to do this in a loop? Thank you. (3 Replies)
Discussion started by: ksgreen
3 Replies

6. Programming

Converting XImage to PNG

i was able to make a connection to X server and get a screen shot using XGetImage, now, im unable to save this XImage to any good format like PNG, i found a code that saves it to bitmap, but the resulted bitmap file is massive, is there anyway i can save this XImage to PNG directly? thanks; (7 Replies)
Discussion started by: JonhyM
7 Replies

7. UNIX for Dummies Questions & Answers

Loop through directory and extract sub directory names

I am trying to loop through folders and extract the name of the lowest level subfolder I was running the script below, it returns /bb/bin/prd/newyork /bb/bin/prd/london /bb/bin/prd/tokyo I really want newyork london tokyo I couldn't find a standard variable for the lowest level... (1 Reply)
Discussion started by: personalt
1 Replies

8. Shell Programming and Scripting

Sendmail Png Attachments

I use sendmail to send html emails, my script works perfect and sends email with plain text attachment. Now i need to attache png file to the email and this attachment part is not working. ( echo "From: $FROM" echo "To: $TO" echo "MIME-Version: 1.0" echo "Subject: $SUBJECT" echo... (4 Replies)
Discussion started by: posner
4 Replies

9. Shell Programming and Scripting

Convert jpg file to binary format

Hi Team, Here's the requirement. I have a image file in jpg format in unix. Now I need to i. convert the jpg format to binary format ii. followed by loading the binary file to Oracle db. Can anyone help me out? Thanks Krishnakanth Manivannan (4 Replies)
Discussion started by: kmanivan82
4 Replies

10. Shell Programming and Scripting

Convert values in an array using a loop

I have a headerless array of 1000 columns x 100000 rows. The array only contains 4 values; 0/0, 0/1, 1/1, ./. Here I am showing the 1st 3 rows and columns of the input array 0/0 0/0 1/1 0/1 0/1 0/1 0/0 ./. 0/0 0/0 0/0 0/0 I would like to convert the values in... (9 Replies)
Discussion started by: Geneanalyst
9 Replies
pilot-foto(1)							    PILOT-LINK							     pilot-foto(1)

NAME
pilot-foto - Palm 'Foto' Image Installer/Remover/Fetcher/Converter SECTION
pilot-link: Userland conduits SYNOPSIS
pilot-foto [-p|--port <port>] [--version] [-?|--help] [-q|--quiet] [--usage] [-d|--delete] [--delete-all] [-i|--install] [-l|--list] [-f|--fetch] [-F|--fetch-all] [-c|--convert] DESCRIPTION
This is a palm conduit to fetch, install, or remove, Foto files from a Palm. It can also convert *.jpg.pdb files that have already been fetched from the Palm to jpeg files. Delete all, or named fotos from handheld. Install one, or many jpeg images to handheld. List all jpeg files and thumbnails on handheld. Fetch all jpeg files, or certain ones by name. Tries to detect if a file really is a jpeg and refuses to install it, if it is not. pilot-foto allows you to do multiple operations in one sync. For instance, delete test.jpg and install test.jpg. USAGE
pilot-foto -p <port> [options] file OPTIONS
pilot-foto options -d, --delete Delete a jpg file on the handheld --delete-all Delete ALL jpg files on the handheld -i, --install Install a jpg file -l, --list List all photos and thumbnails -f, --fetch Fetch files from the Palm -F, --fetch-all Fetch ALL jpg files from the Palm -c, --convert convert [file].jpg.pdb files to jpg Conduit Options -p, --port port Use device file port to communicate with the Palm handheld. If this is not specified, pilot-foto will look for the $PILOTPORT environment variable. If neither are found or supplied, pilot-foto will print the usage information. -q, --quiet Suppress 'Hit HotSync button' message -v, --version Display version of pilot-foto and exit without connecting. Help Options -h, --help Display the help synopsis for pilot-foto and exit without connecting. --usage Display a brief usage message and exit without connecting. EXAMPLES
Examples: pilot-foto -p /dev/pilot -f pilot-foto -d MyImage.jpg pilot-foto -i MyImage.jpg pilot-foto -i *.jpg pilot-foto -f MyImage pilot-foto -c MyImage.jpg.pdb PROBLEMS
Palm has not published their database format for the thumbnails. So, pilot-foto puts a generic penguin thumbnail for every image uploaded. Fotos can be accessed by a named list on the handheld as well as the thumbnails. This has been tried on a couple of handhelds. It is possi- ble that a foreign palm or different model will not like it. To get a thumbnail image you can copy the jpegs to the memory card. If you copy them back to the handheld they will have a new thumbnail that matches the jpeg. AUTHOR
This manual page was converted to XML by Neil Williams <linux@codehelp.co.uk> BUGS
If a jpeg is installed with the same name as one already on the palm you will have 2 thumbnails pointing to the same jpeg. The new jpeg will overwrite the old jpeg. If the thumbnail fails to install then the jpeg should be removed. It is not. We have an online bug tracker. Using this is the only way to ensure that your bugs are recorded and that we can track them until they are resolved or closed. Reporting bugs via email, while easy, is not very useful in terms of accountability. Please point your browser to http://bugs.pilot-link.org: http://bugs.pilot-link.org and report your bugs and issues there. COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. SEE ALSO
pilot-link(7) 0.12.5 Copyright 1996-2007 FSF pilot-foto(1)
All times are GMT -4. The time now is 02:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy